Plug memory leaks

This commit is contained in:
Darshit Shah 2014-07-23 22:28:36 +05:30
parent 3d7797c46e
commit eab853b7e6
2 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2014-07-23 Darshit Shah <darnir@gmail.com>
* 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 <daniel@haxx.se>
* main.c (print_help): HTTP Method is a part of the Request not Header

View File

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