]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Re: elflink.c memory leaks
authorAlan Modra <amodra@gmail.com>
Mon, 20 Jan 2025 01:03:49 +0000 (11:33 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 20 Jan 2025 07:46:15 +0000 (18:16 +1030)
* elflink.c (elf_link_add_object_symbols): Free old_strtab
in another code path.  Revert one unnecessary change in last
patch.

bfd/elflink.c

index 8974015728d45ca4b297128aa0eb97eba45b50a7..27b02dd404f739d9ad4b85db678cfbeb94390e4c 100644 (file)
@@ -5807,6 +5807,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
       return true;
     }
 
+  free (old_strtab);
+  old_strtab = NULL;
   if (old_tab != NULL)
     {
       if (!(*bed->notice_as_needed) (abfd, info, notice_needed))
@@ -6030,7 +6032,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
 
   if (bed->check_directives
       && !(*bed->check_directives) (abfd, info))
-    goto error_free_vers;
+    goto error_return;
 
   /* If this is a non-traditional link, try to optimize the handling
      of the .stab/.stabstr sections.  */