-
Notifications
You must be signed in to change notification settings - Fork 390
fix memory leak in -E mode #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix memory leak in -E mode #64
Conversation
4e3099c to
31816e7
Compare
|
Is this still a problem? |
|
I tested the latest commit 22a9118 in In order to reproduce the problem one can run In this specific bug the problematic file is So, essentially the same problem as I reported originally. |
When running with -fsanitize=leak enabled nasm prints this error:
Direct leak of 124 byte(s) in 20 object(s) allocated from:
#0 0x7e96126fd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
netwide-assembler#1 0x55a08fa0f6b5 in nasm_malloc nasmlib/alloc.c:25
netwide-assembler#2 0x55a08f90db3a in detoken asm/preproc.c:2219
netwide-assembler#3 0x55a08f949b38 in pp_getline asm/preproc.c:8815
netwide-assembler#4 0x55a08f8ab33e in main asm/nasm.c:602
netwide-assembler#5 0x7e9611a2a1c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
netwide-assembler#6 0x7e9611a2a28a in __libc_start_main_impl ../csu/libc-start.c:360
netwide-assembler#7 0x55a08f8a6e84 in _start (/home/ivan/d/nasm/nasm+0x34be84)
This is reproducible on tests that do preprocessing for example
weirdpaste.asm test.
The problem is caused by the fact that the line returned by pp_getline
isn't freed in main function.
Signed-off-by: Ivan Sorokin <[email protected]>
31816e7 to
ba58085
Compare
|
I rebased the patch so it applies cleanly to the latest master. I also retested the patch and I can confirm that without it the |
When running with
-fsanitize=leakenabled nasm prints these errors:This is reproducible on tests that do preprocessing for example
weirdpastetest.The problem is caused by the fact that the line returned by
pp_getlineisn't freed inmainfunction.