]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
plugin_get_ir_dummy_bfd leak
authorAlan Modra <amodra@gmail.com>
Sat, 11 Jan 2025 05:47:20 +0000 (16:17 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 16 Jan 2025 22:07:29 +0000 (08:37 +1030)
* plugin.c (plugin_get_ir_dummy_bfd): Free bfd filename.

ld/plugin.c

index ea0c6fcdd67b16249514c2b7feb8f830508f8132..4a21d1307426b2b7f6fe18d57aa37ffe577137b7 100644 (file)
@@ -315,12 +315,11 @@ plugin_opt_plugin_arg (const char *arg)
 static bfd *
 plugin_get_ir_dummy_bfd (const char *name, bfd *srctemplate)
 {
-  bfd *abfd;
-  bool bfd_plugin_target;
-
-  bfd_plugin_target = bfd_plugin_target_p (srctemplate->xvec);
-  abfd = bfd_create (concat (name, IRONLY_SUFFIX, (const char *) NULL),
-                    bfd_plugin_target ? link_info.output_bfd : srctemplate);
+  bool bfd_plugin_target = bfd_plugin_target_p (srctemplate->xvec);
+  char *filename = concat (name, IRONLY_SUFFIX, (const char *) NULL);
+  bfd *abfd = bfd_create (filename, (bfd_plugin_target
+                                    ? link_info.output_bfd : srctemplate));
+  free (filename);
   if (abfd != NULL)
     {
       abfd->flags |= BFD_LINKER_CREATED | BFD_PLUGIN;