aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-01-25 12:06:50 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-01-25 12:06:50 +0100
commitdbcaa0065719acc0383307f13d02d3d0c9b5c635 (patch)
treeba5429e85c29deb20b592350552744d3a8631963 /lib
parent4b837a7e1541c151f6ea16fde92b6f57c5827d8a (diff)
HTTP: memory leak on multiple Location:
The HTTP parser allocated memory on each received Location: header without properly freeing old data. Starting now, the code only considers the first Location: header and will blissfully ignore subsequent ones. Bug: http://curl.haxx.se/bug/view.cgi?id=3165129 Reported by: Martin Lemke
Diffstat (limited to 'lib')
-rw-r--r--lib/http.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/http.c b/lib/http.c
index b61426ec5..40ae6b7db 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -3723,7 +3723,8 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
return result;
}
else if((k->httpcode >= 300 && k->httpcode < 400) &&
- checkprefix("Location:", k->p)) {
+ checkprefix("Location:", k->p) &&
+ !data->req.location) {
/* this is the URL that the server advises us to use instead */
char *location = Curl_copy_header_value(k->p);
if (!location)
@@ -3732,7 +3733,6 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
/* ignore empty data */
free(location);
else {
- DEBUGASSERT(!data->req.location);
data->req.location = location;
if(data->set.http_follow_location) {