Commit f14e4e97 authored by Rusty Russell's avatar Rusty Russell

pipecmd: fix minor memleak detected by scan-build.

Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent e81b5273
...@@ -16,9 +16,12 @@ static char **gather_args(const char *arg0, va_list ap) ...@@ -16,9 +16,12 @@ static char **gather_args(const char *arg0, va_list ap)
arr[0] = (char *)arg0; arr[0] = (char *)arg0;
while ((arr[n++] = va_arg(ap, char *)) != NULL) { while ((arr[n++] = va_arg(ap, char *)) != NULL) {
arr = realloc(arr, sizeof(char *) * (n + 1)); char **narr = realloc(arr, sizeof(char *) * (n + 1));
if (!arr) if (!narr) {
free(arr);
return NULL; return NULL;
}
arr = narr;
} }
return arr; return arr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment