aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/Makefile8
-rw-r--r--Source/charon/config/child_proposal.obin35520 -> 0 bytes
-rw-r--r--Source/charon/daemon.c7
-rw-r--r--Source/charon/sa/child_sa.c2
-rw-r--r--Source/lib/utils/logger_manager.c3
-rw-r--r--Source/lib/utils/logger_manager.h1
-rw-r--r--Source/testing/leak_detective_test.c24
7 files changed, 33 insertions, 12 deletions
diff --git a/Source/Makefile b/Source/Makefile
index 27a0ea3d4..40308cacb 100644
--- a/Source/Makefile
+++ b/Source/Makefile
@@ -23,13 +23,13 @@ BUILD_DIR= ./bin/
BINNAMECHARON= $(BUILD_DIR)charon
BINNAMESTROKE= $(BUILD_DIR)stroke
BINNAMETEST= $(BUILD_DIR)run_tests
-BINNAMELIB= $(BUILD_DIR)libstrong.so
+BINNAMELIB= $(BUILD_DIR)libstrongswan.so
MAIN_DIR= ./
LDFLAGS= -ldl -lgmp -lpthread -rdynamic
-CFLAGS= -Icharon -Ilib -Istroke -Wall -g -fPIC #-DLEAK_DETECTIVE
+CFLAGS= -Icharon -Ilib -Istroke -Wall -g -fPIC -DLEAK_DETECTIVE
# objects is extended by each included Makefile
CHARON_OBJS=
@@ -61,10 +61,10 @@ $(BINNAMELIB) : build_dir $(LIB_OBJS)
$(CC) -shared $(LIB_OBJS) -o $@
$(BINNAMECHARON) : build_dir $(CHARON_OBJS) $(BINNAMELIB) $(BUILD_DIR)daemon.o
- $(CC) -ldl -lgmp -rdynamic -L./bin -lstrong -lpthread $(CHARON_OBJS) $(BUILD_DIR)daemon.o -o $@
+ $(CC) -ldl -lgmp -rdynamic -L./bin -lstrongswan -lpthread $(CHARON_OBJS) $(BUILD_DIR)daemon.o -o $@
$(BINNAMETEST) : build_dir $(CHARON_OBJS) $(TEST_OBJS) $(BINNAMELIB) $(BUILD_DIR)testcases.o
- $(CC) -L./bin -lstrong $(LDFLAGS) $(CHARON_OBJS) $(TEST_OBJS) $(BUILD_DIR)testcases.o -o $@
+ $(CC) -L./bin -lstrongswan $(LDFLAGS) $(CHARON_OBJS) $(TEST_OBJS) $(BUILD_DIR)testcases.o -o $@
$(BINNAMESTROKE) : build_dir $(BINNAMELIB) $(BUILD_DIR)stroke.o
$(CC) $(LDFLAGS) $(CFLAGS) $(BUILD_DIR)stroke.o -o $@
diff --git a/Source/charon/config/child_proposal.o b/Source/charon/config/child_proposal.o
deleted file mode 100644
index 839923297..000000000
--- a/Source/charon/config/child_proposal.o
+++ /dev/null
Binary files differ
diff --git a/Source/charon/daemon.c b/Source/charon/daemon.c
index 6361f308d..aafc86ab1 100644
--- a/Source/charon/daemon.c
+++ b/Source/charon/daemon.c
@@ -263,12 +263,11 @@ void signal_handler(int signal)
for (i = 0; i < size; i++)
{
- logger->log(logger, ERROR, "\t%s", strings[i]);
+ logger->log(logger, ERROR, " %s", strings[i]);
}
-
free (strings);
-
- charon->kill(charon, "SIGSEGV received");
+ /* kill ourselve the hard way, anything other may result in more SIGSEGVs*/
+ kill(getpid(), SIGKILL);
}
/**
diff --git a/Source/charon/sa/child_sa.c b/Source/charon/sa/child_sa.c
index fd82f123b..28e9cdd46 100644
--- a/Source/charon/sa/child_sa.c
+++ b/Source/charon/sa/child_sa.c
@@ -447,6 +447,8 @@ static status_t add_policies(private_child_sa_t *this, linked_list_t *my_ts_list
{
my_iter->destroy(my_iter);
other_iter->destroy(other_iter);
+ policy->my_net->destroy(policy->my_net);
+ policy->other_net->destroy(policy->other_net);
free(policy);
return status;
}
diff --git a/Source/lib/utils/logger_manager.c b/Source/lib/utils/logger_manager.c
index ab2167699..de92d0aca 100644
--- a/Source/lib/utils/logger_manager.c
+++ b/Source/lib/utils/logger_manager.c
@@ -51,6 +51,8 @@ mapping_t logger_context_t_mappings[] = {
{DER_DECODER, "DER_DECODER"},
{DER_ENCODER, "DER_ENCODER"},
{ASN1, "ASN1"},
+ {XFRM, "XFRM"},
+ {LEAK_DETECT, "LEAK_DETECT"},
{MAPPING_END, NULL},
};
@@ -80,6 +82,7 @@ struct {
{ "DEREC", ERROR|CONTROL|AUDIT|LEVEL0, TRUE }, /* DER_ENCODER */
{ "ASN_1", ERROR|CONTROL|AUDIT|LEVEL0, TRUE }, /* ASN1 */
{ "XFRM ", ERROR|CONTROL|AUDIT|LEVEL0, TRUE }, /* XFRM */
+ { "LEAKD", ERROR|CONTROL|AUDIT|LEVEL0, FALSE}, /* LEAK_DETECT */
};
diff --git a/Source/lib/utils/logger_manager.h b/Source/lib/utils/logger_manager.h
index 08154911a..24806b80f 100644
--- a/Source/lib/utils/logger_manager.h
+++ b/Source/lib/utils/logger_manager.h
@@ -59,6 +59,7 @@ enum logger_context_t {
DER_ENCODER,
ASN1,
XFRM,
+ LEAK_DETECT,
LOGGER_CONTEXT_ROOF,
};
diff --git a/Source/testing/leak_detective_test.c b/Source/testing/leak_detective_test.c
index 193b81803..8d71d9f0f 100644
--- a/Source/testing/leak_detective_test.c
+++ b/Source/testing/leak_detective_test.c
@@ -23,21 +23,33 @@
#include "leak_detective_test.h"
+void *mem_a, *mem_b, *mem_c;
+
void a()
{
- malloc(4);
+ mem_a = malloc(4);
}
void b()
{
a();
- malloc(5);
+ mem_b = malloc(5);
}
void c()
{
b();
- malloc(6);
+ mem_c = malloc(6);
+}
+
+void recursive(int depth)
+{
+ void *tiny = malloc(1);
+ if (--depth > 0)
+ {
+ recursive(depth);
+ }
+ free(tiny);
}
@@ -59,5 +71,9 @@ void test_leak_detective(protected_tester_t *tester)
free(m3);
free(m1);
- //c();
+ c();
+ free(mem_a);
+ free(mem_c);
+ free(mem_b);
+ recursive(10000);
}