[binutils-gdb] PR26836, memory leak in parse_args

Alan Modra amodra@sourceware.org
Mon Dec 14 13:10:30 GMT 2020


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

commit 8da4f428d1663541bdd49f5aa2041d06ac6a06de
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Dec 14 19:34:20 2020 +1030

    PR26836, memory leak in parse_args
    
            PR 26836
            * lexsup.c (parse_args): Free really_longopts, longopts and
            shortopts.

Diff:
---
 ld/ChangeLog | 6 ++++++
 ld/lexsup.c  | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index fcc3b9b7766..8792daf9c19 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2020-12-14  Alan Modra  <amodra@gmail.com>
+
+	PR 26836
+	* lexsup.c (parse_args): Free really_longopts, longopts and
+	shortopts.
+
 2020-12-14  Nick Clifton  <nickc@redhat.com>
 
 	PR 27050
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 88e33a17a08..78b1834e61e 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -1699,6 +1699,10 @@ parse_args (unsigned argc, char **argv)
 	}
     }
 
+  free (really_longopts);
+  free (longopts);
+  free (shortopts);
+
   /* Run a couple of checks on the map filename.  */
   if (config.map_filename)
     {


More information about the Binutils-cvs mailing list