From c3dc804bc03d242b85332dbbc52113d37deab792 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 5 Oct 2014 10:32:09 +0200 Subject: [PATCH] lib/fetch/http.c: try to fix CID 62683 (resource leak) --- lib/fetch/http.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/fetch/http.c b/lib/fetch/http.c index 32599173..72debeba 100644 --- a/lib/fetch/http.c +++ b/lib/fetch/http.c @@ -815,7 +815,7 @@ fetchIO * http_request(struct url *URL, const char *op, struct url_stat *us, struct url *purl, const char *flags) { - conn_t *conn; + conn_t *conn = NULL; struct url *url, *new; int chunked, direct, if_modified_since, need_auth, noredirect; int keep_alive, verbose, cached; @@ -869,6 +869,9 @@ http_request(struct url *URL, const char *op, struct url_stat *us, } /* connect to server or proxy */ + if (conn != NULL) + fetch_close(conn); + if ((conn = http_connect(url, purl, flags, &cached)) == NULL) goto ouch;