[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/24001] New: A memory leak issue was discovered in function
From: |
wcventure at 126 dot com |
Subject: |
[Bug binutils/24001] New: A memory leak issue was discovered in function debug_init in debug.c |
Date: |
Tue, 18 Dec 2018 14:59:41 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=24001
Bug ID: 24001
Summary: A memory leak issue was discovered in function
debug_init in debug.c
Product: binutils
Version: 2.31
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: wcventure at 126 dot com
Target Milestone: ---
Created attachment 11468
--> https://sourceware.org/bugzilla/attachment.cgi?id=11468&action=edit
POC1
Hi there,
A memory leak issue was discovered in debug.c, as distributed in GNU Binutils
2.31.
In debug_init function in debug.c, the is a heap allocation. But this heap
allocation didn't deallocate in the end. The source Code show as follow.
> void *
> debug_init (void)
> {
> struct debug_handle *ret;
>
> ret = (struct debug_handle *) xmalloc (sizeof *ret);
> memset (ret, 0, sizeof *ret);
> return (void *) ret;
> }
Please use the "./objdump -xg $POC" to reproduce the bug.
To reproduce this bug. You need to build bintuils-2.31 with ASAN, setting
following Command:
> export ASAN_OPTIONS=abort_on_error=1:symbolize=1:detect_leaks=1
The Leak Sanitizer dumps the stack trace as follows:
> =================================================================
> ==12163==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 96 byte(s) in 1 object(s) allocated from:
> #0 0x7fcb75396602 in malloc
> (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
> #1 0x8f925b in xmalloc xmalloc.c:147
> #2 0x4734b9 in debug_init /binutils-2.31_ASAN/binutils/debug.c:666
> #3 0x47014b in read_debugging_info /binutils-2.31_ASAN/binutils/rddbg.c:51
> #4 0x41e02c in dump_bfd objdump.c:3637
> #5 0x41e30e in display_object_bfd objdump.c:3688
> #6 0x41e89c in display_any_bfd objdump.c:3777
> #7 0x41e936 in display_file objdump.c:3798
> #8 0x41fb25 in main objdump.c:4100
> #9 0x7fcb7404382f in __libc_start_main
> (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
>
> SUMMARY: AddressSanitizer: 96 byte(s) leaked in 1 allocation(s).
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/24001] New: A memory leak issue was discovered in function debug_init in debug.c,
wcventure at 126 dot com <=