https://sourceware.org/bugzilla/show_bug.cgi?id=22196
Bug ID: 22196 Summary: possible memory leak in libcpu in elfutils 0.170(HEAD) Product: elfutils Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: backends Assignee: unassigned at sourceware dot org Reporter: luanjunchao at 163 dot com CC: elfutils-devel at sourceware dot org Target Milestone: --- When I compile elfutils from the latest source code of git with address sanitizer, it aborted with memory leak. The command I run is "./configure CFLAGS='-g -fsanitize=address' CXXFLAGS='-g -fsanitize=address' --enable-maintainer-mode && make". Part of the log is as follows: ...... Making all in libcpu GEN i386_defs GEN i386.mnemonics CC i386_gendis.o LEX i386_lex.c YACC i386_parse.c updating i386_parse.h CC i386_lex.o CC i386_parse.o CCLD i386_gendis GEN i386_dis.h ================================================================= ==19600==ERROR: LeakSanitizer: detected memory leaks Direct leak of 17088 byte(s) in 3745 object(s) allocated from: #0 0x7ff12d6ba602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51 #2 0x412186 in xstrndup /work/elfutils-asan/lib/xstrndup.c:44 #3 0x402bd3 in i386_lex /work/elfutils-asan/libcpu/i386_lex.l:75 #4 0x407a10 in i386_parse /work/elfutils-asan/libcpu/i386_parse.c:1398 #5 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69 #6 0x7ff12cf6f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) Direct leak of 10608 byte(s) in 663 object(s) allocated from: #0 0x7ff12d6ba602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51 #2 0x409b5e in i386_parse /work/elfutils-asan/libcpu/i386_parse.y:474 #3 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69 #4 0x7ff12cf6f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) Direct leak of 1248 byte(s) in 52 object(s) allocated from: #0 0x7ff12d6ba602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51 #2 0x40a388 in i386_parse /work/elfutils-asan/libcpu/i386_parse.y:534 #3 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69 #4 0x7ff12cf6f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) Indirect leak of 44064 byte(s) in 1836 object(s) allocated from: #0 0x7ff12d6ba602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51 #2 0x409d5d in i386_parse /work/elfutils-asan/libcpu/i386_parse.y:493 #3 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69 #4 0x7ff12cf6f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) Indirect leak of 9168 byte(s) in 573 object(s) allocated from: #0 0x7ff12d6ba602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51 #2 0x409a21 in i386_parse /work/elfutils-asan/libcpu/i386_parse.y:467 #3 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69 #4 0x7ff12cf6f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) Indirect leak of 1344 byte(s) in 56 object(s) allocated from: #0 0x7ff12d6ba602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51 #2 0x40a1c3 in i386_parse /work/elfutils-asan/libcpu/i386_parse.y:525 #3 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69 #4 0x7ff12cf6f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) Indirect leak of 167 byte(s) in 52 object(s) allocated from: #0 0x7ff12d6ba602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51 #2 0x412186 in xstrndup /work/elfutils-asan/lib/xstrndup.c:44 #3 0x402e31 in i386_lex /work/elfutils-asan/libcpu/i386_lex.l:82 #4 0x407a10 in i386_parse /work/elfutils-asan/libcpu/i386_parse.c:1398 #5 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69 #6 0x7ff12cf6f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) SUMMARY: AddressSanitizer: 83687 byte(s) leaked in 6977 allocation(s). Makefile:730: recipe for target 'i386_dis.h' failed make[2]: *** [i386_dis.h] Error 23 rm i386_defs Makefile:485: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 Makefile:401: recipe for target 'all' failed make: *** [all] Error 2 It shows there are memory leaks in i386 arch and I wonder if there are memory leaks in other archs. The os version is ubuntu 16.04 amd64 and I can reproduce it. -- You are receiving this mail because: You are on the CC list for the bug.