diff mbox

[RFA] libiberty/argv.c, expandargv, close memory leak

Message ID 4D740E5C.9060906@vmware.com
State New
Headers show

Commit Message

Michael Snyder March 6, 2011, 10:44 p.m. UTC
OK?
2011-03-06  Michael Snyder  <msnyder@vmware.com>

	* argv.c (expandargv): Close memory leak.
diff mbox

Patch

Index: argv.c
===================================================================
RCS file: /cvs/src/src/libiberty/argv.c,v
retrieving revision 1.22
diff -u -p -r1.22 argv.c
--- argv.c	13 Aug 2010 11:36:10 -0000	1.22
+++ argv.c	6 Mar 2011 22:41:02 -0000
@@ -439,7 +439,10 @@  expandargv (int *argcp, char ***argvp)
 	     due to CR/LF->CR translation when reading text files.
 	     That does not in-and-of itself indicate failure.  */
 	  && ferror (f))
-	goto error;
+	{
+	  xfree (buffer);
+	  goto error;
+	}
       /* Add a NUL terminator.  */
       buffer[len] = '\0';
       /* If the file is empty or contains only whitespace, buildargv would