Fix memory leaks
Closed this issue · 2 comments
evanmiller commented
Fuzz-testing indicates that the chunks are leaking, e.g.
Live Heap Allocations: 1270338425 bytes in 19105005 chunks; quarantined: 265282292 bytes in 256984 chunks; 11596 other chunks; total chunks: 19373585; showing top 95% (at most 8 unique contexts)
1062898432 byte(s) (83%) in 16607788 allocation(s)
#0 0x10c8c86b7 in wrap_calloc (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x5c6b7)
#1 0x10b1ae5ca in process_block_v7 block.c:29
#2 0x10b1b3ddf in process_block block.c:412
#3 0x10b1b7d84 in process_blocks fmp.c:220
#4 0x10b1bc3f2 in fmp_list_tables list_tables.c:48
#5 0x10b1adfb3 in LLVMFuzzerTestOneInput fuzz_fmp.c:9
#6 0x10b1ce6b8 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) FuzzerLoop.cpp:576
#7 0x10b1cddf2 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) FuzzerLoop.cpp:485
#8 0x10b1d011a in fuzzer::Fuzzer::MutateAndTestOne() FuzzerLoop.cpp:713
#9 0x10b1d0de5 in fuzzer::Fuzzer::Loop(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) FuzzerLoop.cpp:844
#10 0x10b1c6a83 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) FuzzerDriver.cpp:765
#11 0x10b1f07a2 in main FuzzerMain.cpp:20
#12 0x7fff67ff0cc8 in start (libdyld.dylib:x86_64+0x1acc8)
44584960 byte(s) (3%) in 696640 allocation(s)
#0 0x10c8c86b7 in wrap_calloc (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x5c6b7)
#1 0x10b1ae5ca in process_block_v7 block.c:29
#2 0x10b1b3ddf in process_block block.c:412
#3 0x10b1b7d84 in process_blocks fmp.c:220
#4 0x10b1bb11d in fmp_list_columns list_columns.c:88
#5 0x10b1ae0ba in LLVMFuzzerTestOneInput fuzz_fmp.c:13
#6 0x10b1ce6b8 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) FuzzerLoop.cpp:576
#7 0x10b1cddf2 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) FuzzerLoop.cpp:485
#8 0x10b1d011a in fuzzer::Fuzzer::MutateAndTestOne() FuzzerLoop.cpp:713
#9 0x10b1d0de5 in fuzzer::Fuzzer::Loop(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) FuzzerLoop.cpp:844
#10 0x10b1c6a83 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) FuzzerDriver.cpp:765
#11 0x10b1f07a2 in main FuzzerMain.cpp:20
#12 0x7fff67ff0cc8 in start (libdyld.dylib:x86_64+0x1acc8)
evanmiller commented
env ASAN_OPTIONS=detect_leaks=1
works wonders in conjunction with -fsanitize=address
evanmiller commented
Think I got them all, for now.