URL: <https://savannah.gnu.org/bugs/?62615>
Summary: Fix the leaks of file->cmds and file->cmds->commands Project: make Submitter: dgoncharov Submitted: Sat 11 Jun 2022 01:52:52 PM UTC Severity: 3 - Normal Item Group: Bug Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: SCM Operating System: Any Fixed Release: None Triage Status: None _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Sat 11 Jun 2022 01:52:52 PM UTC By: Dmitry Goncharov <dgoncharov> Makefile like the following causes make to leak file->cmds along with file->cmds->commands allocated for the 1st hello.o rule. +++ all: hello.o hello.o: hello.h; $(info 1 $@ from $^) hello.o: hello.c; $(info 2 $@ from $^) ---- To see the leak build with -fsanitize=leak ++++ $ make makefile2:5: warning: overriding recipe for target 'hello.o' makefile2:4: warning: ignoring old recipe for target 'hello.o' 2 hello.o from hello.c hello.h make: Nothing to be done for 'all'. ================================================================= ==13813==ERROR: LeakSanitizer: detected memory leaks Direct leak of 56 byte(s) in 1 object(s) allocated from: #0 0x7fb54a09bc9c in __interceptor_malloc /var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/gcc-10.2.0/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x558a7a3aae35 in xmalloc ../src/misc.c:190 #2 0x558a7a3c1923 in record_files ../src/read.c:2011 #3 0x558a7a3b6f0d in eval ../src/read.c:1009 #4 0x558a7a3b2a3c in eval_makefile ../src/read.c:438 #5 0x558a7a3b0a38 in read_all_makefiles ../src/read.c:223 #6 0x558a7a397ff7 in main ../src/main.c:1971 #7 0x7fb54953bc4e in __libc_start_main (/lib64/libc.so.6+0x23c4e) Indirect leak of 23 byte(s) in 1 object(s) allocated from: #0 0x7fb54a09bc9c in __interceptor_malloc /var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/gcc-10.2.0/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x7fb54a04660d in __interceptor_strndup /var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/gcc-10.2.0/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:395 #2 0x558a7a3aaf88 in xstrndup ../src/misc.c:252 #3 0x558a7a3c1b07 in record_files ../src/read.c:2015 #4 0x558a7a3b6f0d in eval ../src/read.c:1009 #5 0x558a7a3b2a3c in eval_makefile ../src/read.c:438 #6 0x558a7a3b0a38 in read_all_makefiles ../src/read.c:223 #7 0x558a7a397ff7 in main ../src/main.c:1971 #8 0x7fb54953bc4e in __libc_start_main (/lib64/libc.so.6+0x23c4e) SUMMARY: AddressSanitizer: 79 byte(s) leaked in 2 allocation(s). ---- _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?62615> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/