diff options
author | Alan Modra <amodra@gmail.com> | 2025-01-11 16:17:20 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2025-01-17 08:37:29 +1030 |
commit | 82a944eda3e983e48f48cbc3556496f63e9f3087 (patch) | |
tree | a6f96df5879320a88046a57f33a9b71d80237514 | |
parent | 64d357bc45f26eae5d8316cec740749727fa66b7 (diff) | |
download | binutils-82a944eda3e983e48f48cbc3556496f63e9f3087.zip binutils-82a944eda3e983e48f48cbc3556496f63e9f3087.tar.gz binutils-82a944eda3e983e48f48cbc3556496f63e9f3087.tar.bz2 |
plugin_get_ir_dummy_bfd leak
* plugin.c (plugin_get_ir_dummy_bfd): Free bfd filename.
-rw-r--r-- | ld/plugin.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ld/plugin.c b/ld/plugin.c index ea0c6fc..4a21d13 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -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; |