From a44841cbe2abe712de84d7413c31fc14b44225a7 Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Mon, 21 Jul 2014 13:25:54 +0530 Subject: Fix potential memory leak and libpsl configure --- src/ChangeLog | 5 +++++ src/cookies.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 91eda5f0..e668583f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-07-21 Darshit Shah + + * cookies.c (check_domain_match): Fix a potential memory leak when checking + cookie domain names + 2014-07-07 Tomas Hozza * iri.c (locale_to_utf8): Fix checking of iconv_open return code. diff --git a/src/cookies.c b/src/cookies.c index 76301acc..bf872a88 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -546,9 +546,12 @@ check_domain_match (const char *cookie_domain, const char *host) xfree (cookie_domain_lower); xfree (host_lower); - return true ? (is_acceptable == 1) : false; + return is_acceptable == 1; no_psl: + /* Cleanup the PSL pointers first */ + xfree (cookie_domain_lower); + xfree (host_lower); #endif /* For efficiency make some elementary checks first */ -- cgit v1.2.1 From 3d7797c46e2f060d84566b530b29cb498bc940c4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 23 Jul 2014 14:10:18 +0200 Subject: main.c: update the --method description The first line of a HTTP request is not a header, it is the start-line, which for requests is called the request-line. See http://tools.ietf.org/html/rfc7230#section-3.1 --- src/ChangeLog | 4 ++++ src/main.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e668583f..38d0ce37 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2014-07-21 Daniel Stenberg + + * main.c (print_help): HTTP Method is a part of the Request not Header + 2014-07-21 Darshit Shah * cookies.c (check_domain_match): Fix a potential memory leak when checking diff --git a/src/main.c b/src/main.c index 70930ddf..1ada8221 100644 --- a/src/main.c +++ b/src/main.c @@ -614,7 +614,7 @@ HTTP options:\n"), N_("\ --post-file=FILE use the POST method; send contents of FILE.\n"), N_("\ - --method=HTTPMethod use method \"HTTPMethod\" in the header.\n"), + --method=HTTPMethod use method \"HTTPMethod\" in the request.\n"), N_("\ --body-data=STRING Send STRING as data. --method MUST be set.\n"), N_("\ -- cgit v1.2.1 From eab853b7e6e0616db139a1130d0db7e5580a28b7 Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Wed, 23 Jul 2014 22:28:36 +0530 Subject: Plug memory leaks --- src/ChangeLog | 8 ++++++++ src/http.c | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.1