From 8663c3bd75019f57edae653548086ae87681dedd Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 19 Apr 2020 11:53:28 +0200 Subject: [PATCH] lib/fetch/common.c: fix CID 284959 (NULL returns). Also fix previous CID. --- lib/fetch/common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/fetch/common.c b/lib/fetch/common.c index 073b3f22..c76a6f9c 100644 --- a/lib/fetch/common.c +++ b/lib/fetch/common.c @@ -764,7 +764,6 @@ fetch_connect(struct url *url, int af, int verbose) } conn->cache_url = fetchCopyURL(url); conn->cache_af = af; - fetchFreeURL(socks_url); return (conn); } @@ -1071,7 +1070,10 @@ fetch_ssl_get_numeric_addrinfo(const char *hostname, size_t len) struct addrinfo hints, *res; char *host; - host = (char *)malloc(len + 1); + host = malloc(len + 1); + if (!host) + return NULL; + memcpy(host, hostname, len); host[len] = '\0'; memset(&hints, 0, sizeof(hints));