memory leak at ld parse_args
Use sanitizer for test and result shows that there are memory leak at parse_args function. Test case: #include int main() { printf("Hello world!\n"); return 0; } binutils version 2.34 Checked on the source code, I did not see any free action on below shortopts, longopts, really_longopts variable. [cid:image001.png@01D6B227.70106680]
[Bug ld/26836] New: potential memory leak in parse_args
https://sourceware.org/bugzilla/show_bug.cgi?id=26836 Bug ID: 26836 Summary: potential memory leak in parse_args Product: binutils Version: 2.34 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: liuyingying19 at huawei dot com Target Milestone: --- Test case: #include int main() { printf("Hello world!\n"); return 0; } ==74578==ERROR: LeakSanitizer: detected memory leaks Direct leak of 5664 byte(s) in 1 object(s) allocated from: #0 0x7fedf6816860 in __interceptor_malloc ../../.././libsanitier/asasn/asan_malloc_linux.cc:62 #1 0x560879e0b151 in parse_args (/usr/bin/riscv32-unknown-elf-ld+03d151) binutils version 2.34 Checked on the source code, I did not see any free action on below shortopts, longopts, really_longopts variable. ld/lexsup.c shortopts = (char *) xmalloc (OPTION_COUNT * 3 + 2); longopts = (struct option *) xmalloc (sizeof (*longopts) * (OPTION_COUNT + 1)); really_longopts = (struct option *) malloc (sizeof (*really_longopts) * (OPTION_COUNT + 1)); -- You are receiving this mail because: You are on the CC list for the bug.