]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Re: dlltool memory leaks
authorAlan Modra <amodra@gmail.com>
Sat, 22 Nov 2025 06:23:00 +0000 (16:53 +1030)
committerAlan Modra <amodra@gmail.com>
Sat, 22 Nov 2025 06:28:34 +0000 (16:58 +1030)
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.

binutils/dlltool.c

index 99c651f7f9b23568e4fe93184f0676df67cb8366..8b888fe5a7a2a070dd8926215efb54ab71f10136 100644 (file)
@@ -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);