Browse Source

core: fix memory leak if url change fails

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau 8 years ago
parent
commit
77164692aa
1 changed files with 3 additions and 1 deletions
  1. 3 1
      uclient.c

+ 3 - 1
uclient.c

@@ -182,8 +182,10 @@ int uclient_set_url(struct uclient *cl, const char *url_str, const char *auth_st
 	if (!url)
 		return -1;
 
-	if (url->backend != cl->backend)
+	if (url->backend != cl->backend) {
+		free(url);
 		return -1;
+	}
 
 	free(cl->url);
 	cl->url = url;