lib/fetch: fix CID 284966 in a different way.

Hopefully this fixes it for real.
This commit is contained in:
Juan RP 2020-04-20 10:31:13 +02:00
parent 8663c3bd75
commit 35ae128826
No known key found for this signature in database
GPG Key ID: AF19F6CB482F9368
2 changed files with 8 additions and 2 deletions

View File

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

View File

@ -571,7 +571,12 @@ ouch:
void
fetchFreeURL(struct url *u)
{
free(u->doc);
if (!u) {
return;
}
if (u->doc) {
free(u->doc);
}
free(u);
}