public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PR26578, memory leak in parse_gnu_debugaltlink
@ 2020-09-09  8:22 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2020-09-09  8:22 UTC (permalink / raw)
  To: binutils

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/dwarf.c b/binutils/dwarf.c
index 616e534849..9c141b1776 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,

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-09  8:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09  8:22 PR26578, memory leak in parse_gnu_debugaltlink Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).