[binutils-gdb/binutils-2_45-branch] Re: dlltool memory leaks
Alan Modra
amodra@sourceware.org
Sat Nov 22 08:13:16 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b136efd10a7c8b278b5356ab7923f4ed9f064517
commit b136efd10a7c8b278b5356ab7923f4ed9f064517
Author: Alan Modra <amodra@gmail.com>
Date: Sat Nov 22 16:53:00 2025 +1030
Re: dlltool memory leaks
I missed one needed strdup of symbol names, needed since the original
symbol name memory is freed on bfd_close.
PR 33651
* dlltool.c (scan_filtered_symbols): xstrdup symbol name.
(cherry picked from commit d37a8694b28d162c5e0ed0edd5948687bc228edc)
Diff:
---
binutils/dlltool.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 99c651f7f9b..8b888fe5a7a 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -1428,6 +1428,7 @@ scan_filtered_symbols (bfd *abfd, void *minisyms, long symcount,
if (*symbol_name
&& *symbol_name == bfd_get_symbol_leading_char (abfd))
++symbol_name;
+ symbol_name = xstrdup (symbol_name);
def_exports (symbol_name , 0, -1, 0, 0,
! (sym->flags & BSF_FUNCTION), 0, NULL);
More information about the Binutils-cvs
mailing list