PR26836, memory leak in parse_args

Alan Modra amodra@gmail.com
Mon Dec 14 13:08:58 GMT 2020


I'm reasonably confident there aren't any pointers into these arrays.

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

diff --git a/ld/lexsup.c b/ld/lexsup.c
index 88e33a17a0..78b1834e61 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)
     {

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list