[binutils-gdb] dlltool invalid free

Alan Modra amodra@sourceware.org
Tue Jun 10 21:56:34 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9efb7cdef40b3df83a1ec3cdbda882b1a626bb0e

commit 9efb7cdef40b3df83a1ec3cdbda882b1a626bb0e
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Jun 10 22:57:46 2025 +0930

    dlltool invalid free
    
    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.

Diff:
---
 binutils/defparse.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/binutils/defparse.y b/binutils/defparse.y
index d50739eb801..a2c4c4b6196 100644
--- a/binutils/defparse.y
+++ b/binutils/defparse.y
@@ -213,7 +213,7 @@ opt_name2: ID { $$ = $1; }
 	  }
 	;
 opt_name: opt_name2 { $$ =$1; }
-	|		{ $$=""; }
+	|		{ $$ = xstrdup (""); }
 	;
 
 opt_ordinal:


More information about the Binutils-cvs mailing list