]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
dlltool invalid free
authorAlan Modra <amodra@gmail.com>
Tue, 10 Jun 2025 13:27:46 +0000 (22:57 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 10 Jun 2025 21:56:07 +0000 (07:26 +0930)
This is a followup to commt 619f863c55ca "dlltool memory leaks".
The name passed to def_name is freed, so if missing we can't just
use "".  strdup it.

* defparse.y (opt_name): xstrdup empty string.

binutils/defparse.y

index d50739eb80116bfd69acb45887725afddfaa4afe..a2c4c4b61963d96da2fe5547d8bd6cde87b1fcc0 100644 (file)
@@ -213,7 +213,7 @@ opt_name2: ID { $$ = $1; }
          }
        ;
 opt_name: opt_name2 { $$ =$1; }
-       |               { $$=""; }
+       |               { $$ = xstrdup (""); }
        ;
 
 opt_ordinal: