This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR24933, Memory leak in elf_x86_64_get_synthetic_symtab


	PR 24933
	* elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Don't exit
	on error without freeing plts[] contents.

diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 78ed41ad38..634f911ca5 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -2171,17 +2171,18 @@ _bfd_x86_elf_get_synthetic_symtab (bfd *abfd,
 			      bfd_vma);
   bfd_boolean (*valid_plt_reloc_p) (unsigned int);
 
+  dynrelbuf = NULL;
   if (count == 0)
-    return -1;
+    goto bad_return;
 
   dynrelbuf = (arelent **) bfd_malloc (relsize);
   if (dynrelbuf == NULL)
-    return -1;
+    goto bad_return;
 
   dynrelcount = bfd_canonicalize_dynamic_reloc (abfd, dynrelbuf,
 						dynsyms);
   if (dynrelcount <= 0)
-    return -1;
+    goto bad_return;
 
   /* Sort the relocs by address.  */
   qsort (dynrelbuf, dynrelcount, sizeof (arelent *),

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]