If install-xattr is compiled with address sanitizer, every emerge ends with: >>> Emerging (1 of 1) app-portage/eix-0.30.11::gentoo * eix-0.30.11.tar.bz2 SHA256 SHA512 size ;-) ... [ ok ] ================================================================= ==24888==ERROR: LeakSanitizer: detected memory leaks Direct leak of 4097 byte(s) in 1 object(s) allocated from: #0 0x4bc202 in __interceptor_malloc /var/tmp/portage/sys-devel/llvm-3.6.1/work/llvm-3.6.1.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:40:3 #1 0x46607c in __interceptor_realpath /var/tmp/portage/sys-devel/llvm-3.6.1/work/llvm-3.6.1.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:2521:46 #2 0x4db6ae in main /tmp/portage/sys-apps/install-xattr-0.5/work/install-xattr/install-xattr.c:245:17 #3 0x7fdec8f02854 in __libc_start_main /tmp/portage/sys-libs/glibc-2.21-r1/work/glibc-2.21/csu/libc-start.c:289
(In reply to Agostino Sarubbo from comment #0) > If install-xattr is compiled with address sanitizer, every emerge ends with: > > > >>> Emerging (1 of 1) app-portage/eix-0.30.11::gentoo > * eix-0.30.11.tar.bz2 SHA256 SHA512 size ;-) ... > [ ok ] > > ================================================================= > ==24888==ERROR: LeakSanitizer: detected memory leaks > > Direct leak of 4097 byte(s) in 1 object(s) allocated from: > #0 0x4bc202 in __interceptor_malloc > /var/tmp/portage/sys-devel/llvm-3.6.1/work/llvm-3.6.1.src/projects/compiler- > rt/lib/asan/asan_malloc_linux.cc:40:3 > #1 0x46607c in __interceptor_realpath > /var/tmp/portage/sys-devel/llvm-3.6.1/work/llvm-3.6.1.src/projects/compiler- > rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:2521:46 > #2 0x4db6ae in main > /tmp/portage/sys-apps/install-xattr-0.5/work/install-xattr/install-xattr.c: > 245:17 > #3 0x7fdec8f02854 in __libc_start_main > /tmp/portage/sys-libs/glibc-2.21-r1/work/glibc-2.21/csu/libc-start.c:289 This is confusing because you are emerging eix but llvm's asan is pointing to install-xattr. Can you give me steps to reproduce this when building outside of the portage environment? Just unpack the tarball and run make. See if you get the same problems at line 245. Also, a memory leak in install-xattr is harmless. It is a short lived process and even if we do identify it I may not fix it if it means extra coding gymnastics. I would just add a comment.
1) CC="clang" CFLAGS="-fsanitize=address" emerge -q install-xattr 2) type install-xattr and you will see the leak
just to be clear, not all leaks are bad. if you allocated memory and then rely on exit() to free things, that's what we want. doing a whole bunch of free() calls just before you exit is wasteful and needlessly slows things down. that said, asan provides a define you can check for (__SANITIZE_ADDRESS__) so you can put all the free statements behind that to avoid slowing down the normal code path.
if you think that it is not an issue, feel free to close.