From c2bb6bc875e2fe8321d29b87110cd75f1a74355e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Wed, 29 Oct 2014 16:53:16 +0100 Subject: [PATCH] fix memory leak --- src/ChangeLog | 4 ++++ src/http.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 91bb27c6..c32c82c4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,10 @@ * openssl.c (ssl_init) [! OPENSSL_NO_SSL3]: Add guard for OpenSSL without SSLv3. +2014-10-29 Tim Ruehsen + + * http.c (gethttp): fix memory leak + 2014-10-29 Tim Ruehsen * http.c (gethttp): use CLOSE_INVALIDATE instead of fd_close diff --git a/src/http.c b/src/http.c index 591180da..844f8004 100644 --- a/src/http.c +++ b/src/http.c @@ -2071,6 +2071,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy, request_free (req); return HERR; } + xfree_null(hs->message); hs->message = xstrdup (message); resp_free (resp); xfree (head); @@ -2249,6 +2250,7 @@ read_header: goto read_header; } + xfree_null(hs->message); hs->message = xstrdup (message); if (!opt.server_response) logprintf (LOG_VERBOSE, "%2d %s\n", statcode, @@ -2423,6 +2425,7 @@ read_header: xfree (head); xfree (auth_stat); xfree (hs->message); + hs->message = NULL; goto retry_with_auth; } else @@ -3415,6 +3418,7 @@ Remote file exists.\n\n")); count = 0; /* the retrieve count for HEAD is reset */ xfree_null (hstat.message); xfree_null (hstat.error); + hstat.message = NULL; continue; } /* send_head_first */ } /* !got_head */