diff --git a/lib/fetch/common.c b/lib/fetch/common.c index c76a6f9c..9a5ef748 100644 --- a/lib/fetch/common.c +++ b/lib/fetch/common.c @@ -697,7 +697,7 @@ fetch_connect(struct url *url, int af, int verbose) { conn_t *conn; char pbuf[10]; - struct url *socks_url, *connurl; + struct url *socks_url = NULL, *connurl; const char *socks_proxy; struct addrinfo hints, *res0; int sd, error; @@ -761,6 +761,7 @@ fetch_connect(struct url *url, int af, int verbose) return NULL; } } + fetchFreeURL(socks_url); } conn->cache_url = fetchCopyURL(url); conn->cache_af = af; diff --git a/lib/fetch/fetch.c b/lib/fetch/fetch.c index feaf768d..fbf6c6fd 100644 --- a/lib/fetch/fetch.c +++ b/lib/fetch/fetch.c @@ -571,7 +571,12 @@ ouch: void fetchFreeURL(struct url *u) { - free(u->doc); + if (!u) { + return; + } + if (u->doc) { + free(u->doc); + } free(u); }