diff mbox series

[OpenWrt-Devel,6/6] uclient: Handle memory allocation failure for url

Message ID 20180218033640.17715-7-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.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/uclient.c b/uclient.c
index 8862b55..dfbe26c 100644
--- a/uclient.c
+++ b/uclient.c
@@ -59,6 +59,9 @@  __uclient_get_url(const struct uclient_backend *backend,
 		&uri_buf, strlen(location) + 1,
 		&auth_buf, auth_str ? strlen(auth_str) + 1 : 0);
 
+	if(!url)
+		return NULL;
+
 	url->backend = backend;
 	url->location = strcpy(uri_buf, location);
 	if (host)