-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ASAN detected memory leaks at strange position. #789
Comments
This happens because you preload ASan library to GCC and it detects leaks there (AFAIK those are known and ignored in community). Why do you need LD_PRELOAD at all? To run your binary (main) under ASan it's simply enough to compile it with |
@chefmax Thanks for response
|
Ha~ I found I works while I set LD_PRELOAD before run ./main and after compile main.c, like following:
@chefmax , Thank you really! |
Hello everybody,I'm new for ASAN and I get some trouble while using ASAN. Could anybody give me a hand? Thanks a lot!!!
My machine infomation:
and I installed gcc-6.2.0 on /opt/gcc-6.2.0/
I set the LD_LIBRARY_PATH and LD_PRELOAD like following:
Then I make the main.c
compile like this:
And finally I GOT:
# /opt/gcc-6.2.0/bin/gcc -fsanitize=address -ggdb -o main main.c
=================================================================
==27977==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 120 byte(s) in 8 object(s) allocated from:
#0 0x7f7037c9edd8 in __interceptor_malloc ../../../../libsanitizer/asan/asan_malloc_linux.cc:62
#1 0x108f3a7 in xmalloc ../../libiberty/xmalloc.c:148
Direct leak of 32 byte(s) in 4 object(s) allocated from:
#0 0x7f7037c9edd8 in __interceptor_malloc ../../../../libsanitizer/asan/asan_malloc_linux.cc:62
#1 0x108f3a7 in xmalloc ../../libiberty/xmalloc.c:148
#2 0x1ffffffffffffff ()
Direct leak of 14 byte(s) in 2 object(s) allocated from:
#0 0x7f7037c9edd8 in __interceptor_malloc ../../../../libsanitizer/asan/asan_malloc_linux.cc:62
#1 0x108f3a7 in xmalloc ../../libiberty/xmalloc.c:148
#2 0x60800000289f ()
Direct leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x7f7037c9edd8 in __interceptor_malloc ../../../../libsanitizer/asan/asan_malloc_linux.cc:62
#1 0x108f3a7 in xmalloc ../../libiberty/xmalloc.c:148
#2 0x60400000ac0f ()
Direct leak of 7 byte(s) in 1 object(s) allocated from:
#0 0x7f7037c9edd8 in __interceptor_malloc ../../../../libsanitizer/asan/asan_malloc_linux.cc:62
#1 0x108f3a7 in xmalloc ../../libiberty/xmalloc.c:148
#2 0x10001ffff ()
SUMMARY: AddressSanitizer: 181 byte(s) leaked in 16 allocation(s).
=================================================================
==27976==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 247 byte(s) in 4 object(s) allocated from:
#0 0x7f9a3c537dd8 in __interceptor_malloc ../../../../libsanitizer/asan/asan_malloc_linux.cc:62
#1 0x466d97 in xmalloc ../../libiberty/xmalloc.c:148
Indirect leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x7f9a3c537dd8 in __interceptor_malloc ../../../../libsanitizer/asan/asan_malloc_linux.cc:62
#1 0x466d97 in xmalloc ../../libiberty/xmalloc.c:148
SUMMARY: AddressSanitizer: 263 byte(s) leaked in 5 allocation(s).
The text was updated successfully, but these errors were encountered: