projects
/
gcc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d909ead
)
[PATCH v2] libiberty(argv.c): Fix memory leak in expandargv
author
Ayush Mittal
<ayush.m@samsung.com>
Fri, 19 Feb 2021 04:59:03 +0000
(21:59 -0700)
committer
Jeff Law
<law@redhat.com>
Fri, 19 Feb 2021 05:00:06 +0000
(22:00 -0700)
libiberty:
* argv.c (expandargv): free allocated buffer if read fails.
libiberty/argv.c
patch
|
blob
|
history
diff --git
a/libiberty/argv.c
b/libiberty/argv.c
index cd97f9071c2f2508a63c2e40bd95985330464952..48dcd102461f69d70331a73975109ddbc5766e66 100644
(file)
--- a/
libiberty/argv.c
+++ b/
libiberty/argv.c
@@
-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