[PATCH v2] libiberty(argv.c): Fix memory leak in expandargv
libiberty: * argv.c (expandargv): free allocated buffer if read fails.
This commit is contained in:
parent
d909ead682
commit
0b2b7ef367
@ -442,7 +442,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))
|
||||
{
|
||||
free (buffer);
|
||||
goto error;
|
||||
}
|
||||
/* Add a NUL terminator. */
|
||||
buffer[len] = '\0';
|
||||
/* If the file is empty or contains only whitespace, buildargv would
|
||||
|
Loading…
x
Reference in New Issue
Block a user