[PATCH 1/5] uclient-fetch: --header: handle alloc error
Sergey Ponomarev
stokito at gmail.com
Thu Apr 6 13:50:50 PDT 2023
Signed-off-by: Sergey Ponomarev <stokito at gmail.com>
---
uclient-fetch.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/uclient-fetch.c b/uclient-fetch.c
index f9f0174..30440b3 100644
--- a/uclient-fetch.c
+++ b/uclient-fetch.c
@@ -650,6 +650,11 @@ int main(int argc, char **argv)
Since the first arg is program and last is a URL.
But user may forget the URL and raw_headers is null terminated so allocate argc */
raw_headers = calloc(argc, sizeof(char *));
+ if (!raw_headers) {
+ if (!quiet)
+ fprintf(stderr, "Unable to allocate memory for headers\n");
+ exit(1);
+ }
}
raw_headers[raw_headers_count] = optarg;
raw_headers_count++;
--
2.37.2
More information about the openwrt-devel
mailing list