#Memory problem(?)

6 messages · Page 1 of 1 (latest)

kindred radishBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

violet plank
#

almost 300 LINES????????????????????????

signal bear
kindred radishBOT
#

@signal bear

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.

rapid yarrow
#

One problem I see is in viewAll() you define char *prefix and never give it a value but then call searchDFS(root, prefix, 0); with the un-initialized pointer as the second argument. searchDFS then attempts to realloc this unassigned pointer.

#
==61301==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x7fffffffe4a0 in thread T0
    #0 0x7ffff765cc38 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x55555555bc5a in searchDFS(node*, char*, int) testfoo.cpp:155
    #2 0x55555555c738 in viewAll() testfoo.cpp:300
    #3 0x55555555c9a4 in main testfoo.cpp:342
    #4 0x7ffff6a40d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #5 0x7ffff6a40e3f in __libc_start_main_impl ../csu/libc-start.c:392
    #6 0x55555555a444 in _start (testfoo+0x6444)