[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
1 changed files with 4 additions and 1 deletions
|
@ -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))
|
||||
goto error;
|
||||
{
|
||||
free (buffer);
|
||||
goto error;
|
||||
}
|
||||
/* Add a NUL terminator. */
|
||||
buffer[len] = '\0';
|
||||
/* If the file is empty or contains only whitespace, buildargv would
|
||||
|
|
Loading…
Add table
Reference in a new issue