uclient-http: Handle memory allocation failure
authorTobias Schramm <tobleminer@gmail.com>
Sun, 18 Feb 2018 12:46:08 +0000 (13:46 +0100)
committerJohn Crispin <john@phrozen.org>
Tue, 20 Feb 2018 07:25:14 +0000 (08:25 +0100)
Add null pointer check to allocation of uclient_http struct

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
uclient-http.c

index 20b8a9a..74cc9a9 100644 (file)
@@ -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);