From: Alan Modra Date: Wed, 9 Sep 2020 07:08:36 +0000 (+0930) Subject: PR26578, memory leak in parse_gnu_debugaltlink X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dfbee68088e822453fdc82f6b8a3a5bc468944b1;p=binutils-gdb.git 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. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index bd636c9a864..89860a0406c 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2020-09-09 Alan Modra + + 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. + 2020-09-08 H.J. Lu PR ld/26587 diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 616e5348490..9c141b17762 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,