[OpenWrt-Devel] [PATCH 4/6] uclient-http: Handle memory allocation failure

Tobias Schramm tobleminer at gmail.com
Sat Feb 17 22:36:38 EST 2018


Signed-off-by: Tobias Schramm <tobleminer at gmail.com>
---
 uclient-http.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/uclient-http.c b/uclient-http.c
index 2a3cf5d..24f091e 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -944,6 +944,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);
 
-- 
2.16.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list