From: Tobias Schramm Date: Sun, 18 Feb 2018 12:46:08 +0000 (+0100) Subject: uclient-http: Handle memory allocation failure X-Git-Url: http://git.archive.openwrt.org/?a=commitdiff_plain;h=66fb58dff445514a53febab5a81a8a16d5ba9d56;p=project%2Fuclient.git uclient-http: Handle memory allocation failure Add null pointer check to allocation of uclient_http struct Signed-off-by: Tobias Schramm --- diff --git a/uclient-http.c b/uclient-http.c index 20b8a9a..74cc9a9 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -946,6 +946,9 @@ static struct uclient *uclient_http_alloc(void) struct uclient_http *uh; uh = calloc_a(sizeof(*uh)); + if (!uh) + return NULL; + uh->disconnect_t.cb = uclient_http_disconnect_cb; blob_buf_init(&uh->headers, 0);