- 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
|
BINNAMECHARON= $(BUILD_DIR)charon
|
||||||
BINNAMESTROKE= $(BUILD_DIR)stroke
|
BINNAMESTROKE= $(BUILD_DIR)stroke
|
||||||
BINNAMETEST= $(BUILD_DIR)run_tests
|
BINNAMETEST= $(BUILD_DIR)run_tests
|
||||||
BINNAMELIB= $(BUILD_DIR)libstrong.so
|
BINNAMELIB= $(BUILD_DIR)libstrongswan.so
|
||||||
|
|
||||||
MAIN_DIR= ./
|
MAIN_DIR= ./
|
||||||
|
|
||||||
LDFLAGS= -ldl -lgmp -lpthread -rdynamic
|
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
|
# objects is extended by each included Makefile
|
||||||
CHARON_OBJS=
|
CHARON_OBJS=
|
||||||
@@ -61,10 +61,10 @@ $(BINNAMELIB) : build_dir $(LIB_OBJS)
|
|||||||
$(CC) -shared $(LIB_OBJS) -o $@
|
$(CC) -shared $(LIB_OBJS) -o $@
|
||||||
|
|
||||||
$(BINNAMECHARON) : build_dir $(CHARON_OBJS) $(BINNAMELIB) $(BUILD_DIR)daemon.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
|
$(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
|
$(BINNAMESTROKE) : build_dir $(BINNAMELIB) $(BUILD_DIR)stroke.o
|
||||||
$(CC) $(LDFLAGS) $(CFLAGS) $(BUILD_DIR)stroke.o -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++)
|
for (i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
logger->log(logger, ERROR, "\t%s", strings[i]);
|
logger->log(logger, ERROR, " %s", strings[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
free (strings);
|
free (strings);
|
||||||
|
/* kill ourselve the hard way, anything other may result in more SIGSEGVs*/
|
||||||
charon->kill(charon, "SIGSEGV received");
|
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);
|
my_iter->destroy(my_iter);
|
||||||
other_iter->destroy(other_iter);
|
other_iter->destroy(other_iter);
|
||||||
|
policy->my_net->destroy(policy->my_net);
|
||||||
|
policy->other_net->destroy(policy->other_net);
|
||||||
free(policy);
|
free(policy);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ mapping_t logger_context_t_mappings[] = {
|
|||||||
{DER_DECODER, "DER_DECODER"},
|
{DER_DECODER, "DER_DECODER"},
|
||||||
{DER_ENCODER, "DER_ENCODER"},
|
{DER_ENCODER, "DER_ENCODER"},
|
||||||
{ASN1, "ASN1"},
|
{ASN1, "ASN1"},
|
||||||
|
{XFRM, "XFRM"},
|
||||||
|
{LEAK_DETECT, "LEAK_DETECT"},
|
||||||
{MAPPING_END, NULL},
|
{MAPPING_END, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -80,6 +82,7 @@ struct {
|
|||||||
{ "DEREC", ERROR|CONTROL|AUDIT|LEVEL0, TRUE }, /* DER_ENCODER */
|
{ "DEREC", ERROR|CONTROL|AUDIT|LEVEL0, TRUE }, /* DER_ENCODER */
|
||||||
{ "ASN_1", ERROR|CONTROL|AUDIT|LEVEL0, TRUE }, /* ASN1 */
|
{ "ASN_1", ERROR|CONTROL|AUDIT|LEVEL0, TRUE }, /* ASN1 */
|
||||||
{ "XFRM ", ERROR|CONTROL|AUDIT|LEVEL0, TRUE }, /* XFRM */
|
{ "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,
|
DER_ENCODER,
|
||||||
ASN1,
|
ASN1,
|
||||||
XFRM,
|
XFRM,
|
||||||
|
LEAK_DETECT,
|
||||||
LOGGER_CONTEXT_ROOF,
|
LOGGER_CONTEXT_ROOF,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,21 +23,33 @@
|
|||||||
#include "leak_detective_test.h"
|
#include "leak_detective_test.h"
|
||||||
|
|
||||||
|
|
||||||
|
void *mem_a, *mem_b, *mem_c;
|
||||||
|
|
||||||
void a()
|
void a()
|
||||||
{
|
{
|
||||||
malloc(4);
|
mem_a = malloc(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void b()
|
void b()
|
||||||
{
|
{
|
||||||
a();
|
a();
|
||||||
malloc(5);
|
mem_b = malloc(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void c()
|
void c()
|
||||||
{
|
{
|
||||||
b();
|
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(m3);
|
||||||
free(m1);
|
free(m1);
|
||||||
|
|
||||||
//c();
|
c();
|
||||||
|
free(mem_a);
|
||||||
|
free(mem_c);
|
||||||
|
free(mem_b);
|
||||||
|
recursive(10000);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user