diff mbox series

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

Message ID 20180218033640.17715-5-tobleminer@gmail.com
State Changes Requested
Delegated to: John Crispin
Headers show
Series uclient: Handle memory allocation failures | expand

Commit Message

Tobias Schramm Feb. 18, 2018, 3:36 a.m. UTC
Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
---
 uclient-http.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

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);