diff --git a/src/ChangeLog b/src/ChangeLog index 38d0ce37..f677f128 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2014-07-23 Darshit Shah + + * http.c (gethttp): Fix a memory leak when retrying authorization + (gethttp): Fix memory leak when trying to parse content disposition headers + (http_loop): Assigning a new value to *local)file without freeing the old + one causes a memory leak + (http_loop): Free the HTTP message and error strings before continuing loop + 2014-07-21 Daniel Stenberg * main.c (print_help): HTTP Method is a part of the Request not Header diff --git a/src/http.c b/src/http.c index e3c105f6..4b99c17d 100644 --- a/src/http.c +++ b/src/http.c @@ -2423,6 +2423,7 @@ read_header: resp_free (resp); xfree (head); xfree (auth_stat); + xfree (hs->message); goto retry_with_auth; } else @@ -2474,6 +2475,8 @@ read_header: local_file)); hs->local_file = url_file_name (u, local_file); } + + xfree_null (local_file); } /* TODO: perform this check only once. */ @@ -3411,6 +3414,8 @@ Remote file exists.\n\n")); got_name = true; *dt &= ~HEAD_ONLY; count = 0; /* the retrieve count for HEAD is reset */ + xfree_null (hstat.message); + xfree_null (hstat.error); continue; } /* send_head_first */ } /* !got_head */ @@ -3558,7 +3563,10 @@ Remote file exists.\n\n")); exit: if (ret == RETROK && local_file) - *local_file = xstrdup (hstat.local_file); + { + xfree_null (*local_file); + *local_file = xstrdup (hstat.local_file); + } free_hstat (&hstat); return ret;