- leak detective is usable, but does not show static function names
- a script which gets address via ldd and resolves address via addr2line would be nice - fixed a leak in child_sa with new detective ;-)
This commit is contained in:
+4
-4
@@ -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 $@
|
||||
|
||||
Binary file not shown.
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ enum logger_context_t {
|
||||
DER_ENCODER,
|
||||
ASN1,
|
||||
XFRM,
|
||||
LEAK_DETECT,
|
||||
LOGGER_CONTEXT_ROOF,
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user