Detected memory leak during archive and extract operations
Closed this issue · 2 comments
geeknik commented
I compiled enchive
with clang
and the -fsanitize=address
flag.
./enchive archive filename
==7853==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 34 byte(s) in 1 object(s) allocated from:
#0 0x4a054b in __interceptor_malloc (/root/enchive/enchive+0x4a054b)
#1 0x4c9221 in storage_directory /root/enchive/src/enchive.c:268:16
#2 0x7fc663bc4b44 in __libc_start_main /build/glibc-qK83Be/glibc-2.19/csu/libc-start.c:287
SUMMARY: AddressSanitizer: 34 byte(s) leaked in 1 allocation(s).
./enchive extract filename
==7867==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 34 byte(s) in 1 object(s) allocated from:
#0 0x4a054b in __interceptor_malloc (/root/enchive/enchive+0x4a054b)
#1 0x4c9221 in storage_directory /root/enchive/src/enchive.c:268:16
#2 0x7fbd7d399b44 in __libc_start_main /build/glibc-qK83Be/glibc-2.19/csu/libc-start.c:287
SUMMARY: AddressSanitizer: 34 byte(s) leaked in 1 allocation(s).
skeeto commented
Thanks for running it under -fsanitize=address and finding this.
However, this memory leak is "intentional" in that I don't care about
freeing it. Dynamic memory allocation is only used when deriving keys
(where it's trivial to clean up), and when constructing paths, so to
avoid any arbitrary path length limitations. The lifetime of path
buffers is the lifetime of the program, so there's no benefit to freeing
them.
geeknik commented
Good to know.