diff options
author | Alan Modra <amodra@gmail.com> | 2020-09-09 16:38:36 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-09-09 16:38:36 +0930 |
commit | dfbee68088e822453fdc82f6b8a3a5bc468944b1 (patch) | |
tree | a53205834f25a35b1a2b85f3f7362f59b79d96f7 /binutils/dwarf.c | |
parent | fb7331ae2b551247a33e8da5387ebc910c4a7308 (diff) | |
download | gdb-dfbee68088e822453fdc82f6b8a3a5bc468944b1.zip gdb-dfbee68088e822453fdc82f6b8a3a5bc468944b1.tar.gz gdb-dfbee68088e822453fdc82f6b8a3a5bc468944b1.tar.bz2 |
PR26578, memory leak in parse_gnu_debugaltlink
The associated check function doesn't do anything with its "data"
param, so nothing to adjust there.
PR 26578
* dwarf.c (parse_gnu_debugaltlink): Don't alloc build_id_data.
(load_separate_debug_files): Use a stack var for build_id_data.
Diffstat (limited to 'binutils/dwarf.c')
-rw-r--r-- | binutils/dwarf.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 616e534..9c141b1 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -10353,15 +10353,10 @@ parse_gnu_debugaltlink (struct dwarf_section * section, void * data) if (id_len < 0x14) return NULL; - build_id_data = calloc (1, sizeof * build_id_data); - if (build_id_data == NULL) - return NULL; - + build_id_data = (Build_id_data *) data; build_id_data->len = id_len; build_id_data->data = section->start + namelen; - * (Build_id_data **) data = build_id_data; - return name; } @@ -10750,7 +10745,7 @@ load_separate_debug_files (void * file, const char * filename) if (load_debug_section (gnu_debugaltlink, file)) { - Build_id_data * build_id_data; + Build_id_data build_id_data; load_separate_debug_info (filename, & debug_displays[gnu_debugaltlink].section, |