From: Alan Modra Date: Sat, 22 Nov 2025 06:23:00 +0000 (+1030) Subject: Re: dlltool memory leaks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b136efd10a7c8b278b5356ab7923f4ed9f064517;p=thirdparty%2Fbinutils-gdb.git 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 --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);