Bug 29433 - Detected memory leaks in readelf
Summary: Detected memory leaks in readelf
Status: RESOLVED OBSOLETE
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.38
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-30 14:38 UTC by tricker51449
Modified: 2022-08-16 09:12 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Exception input (7.45 KB, application/x-executable)
2022-07-30 14:38 UTC, tricker51449
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tricker51449 2022-07-30 14:38:04 UTC
Created attachment 14246 [details]
Exception input

Hi, binutils team

When i use the readelf in binutils-2.38, i get memory leaks by AddressSanitizer.

# ./binutils/readelf -a readelf_crash

==127064==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 8192 byte(s) in 1 object(s) allocated from:
    #0 0x5590aea8ec2e in malloc (/workspace/binutils-2.38/binutils/readelf+0x2b1c2e) (BuildId: 5d094d520f89bb06)
    #1 0x5590aebf660b in xrealloc /workspace/binutils-2.38/libiberty/./xmalloc.c:179:14
    #2 0x5590aebf660b in xcrealloc /workspace/binutils-2.38/binutils/./dwarf.c:10762:10
    #3 0x5590aebf660b in read_and_display_attr_value /workspace/binutils-2.38/binutils/./dwarf.c:2792:7
    #4 0x5590aebefab8 in read_and_display_attr /workspace/binutils-2.38/binutils/./dwarf.c:3342:10
    #5 0x5590aebefab8 in process_debug_info /workspace/binutils-2.38/binutils/./dwarf.c:3956:15
    #6 0x5590aeb00c96 in load_separate_debug_files /workspace/binutils-2.38/binutils/./dwarf.c:11542:11
    #7 0x5590aeb00c96 in process_object /workspace/binutils-2.38/binutils/readelf.c:21967:27
    #8 0x5590aeafbe67 in process_file /workspace/binutils-2.38/binutils/readelf.c:22394:13
    #9 0x5590aeafbe67 in main /workspace/binutils-2.38/binutils/readelf.c:22465:11
    #10 0x7fe068bc6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: 89c3cb85f9e55046776471fed05ec441581d1969)

SUMMARY: AddressSanitizer: 8192 byte(s) leaked in 1 allocation(s).

Attached is the exception input file. Any help would be greatly appreciated.

Thanks & Best regards!
Comment 1 Alan Modra 2022-08-16 09:12:27 UTC
A memory leak in anything but the latest mainline sources will be ignored, unless the leak makes the tools unusable.  Unlike a server, daemon or kernel, the binutils generally do not stay resident long and all memory is freed on process exit.