summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-12-01 17:04:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-12-01 17:04:33 (GMT)
commitbad5ed39cdd84953f935f4442dd92fe3f7afafc2 (patch)
tree29bf64fea60118c7d88ec258410ff18b6c934c1e
parent7ab2088255449e6336167295c4bc3e4a60126b41 (diff)
parent4d17fd253fbba05c643593bcb86515683badb03f (diff)
downloadgit-bad5ed39cdd84953f935f4442dd92fe3f7afafc2.zip
git-bad5ed39cdd84953f935f4442dd92fe3f7afafc2.tar.gz
git-bad5ed39cdd84953f935f4442dd92fe3f7afafc2.tar.bz2
Merge branch 'cb/curl-use-xmalloc'
HTTP transport had possible allocator/deallocator mismatch, which has been corrected. * cb/curl-use-xmalloc: remote-curl: unbreak http.extraHeader with custom allocators
-rw-r--r--http.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/http.c b/http.c
index 027a86d..5f34816 100644
--- a/http.c
+++ b/http.c
@@ -150,7 +150,7 @@ static unsigned long empty_auth_useless =
static struct curl_slist *pragma_header;
static struct curl_slist *no_pragma_header;
-static struct curl_slist *extra_http_headers;
+static struct string_list extra_http_headers = STRING_LIST_INIT_DUP;
static struct active_request_slot *active_queue_head;
@@ -414,11 +414,9 @@ static int http_options(const char *var, const char *value, void *cb)
if (!value) {
return config_error_nonbool(var);
} else if (!*value) {
- curl_slist_free_all(extra_http_headers);
- extra_http_headers = NULL;
+ string_list_clear(&extra_http_headers, 0);
} else {
- extra_http_headers =
- curl_slist_append(extra_http_headers, value);
+ string_list_append(&extra_http_headers, value);
}
return 0;
}
@@ -1202,8 +1200,7 @@ void http_cleanup(void)
#endif
curl_global_cleanup();
- curl_slist_free_all(extra_http_headers);
- extra_http_headers = NULL;
+ string_list_clear(&extra_http_headers, 0);
curl_slist_free_all(pragma_header);
pragma_header = NULL;
@@ -1627,10 +1624,11 @@ int run_one_slot(struct active_request_slot *slot,
struct curl_slist *http_copy_default_headers(void)
{
- struct curl_slist *headers = NULL, *h;
+ struct curl_slist *headers = NULL;
+ const struct string_list_item *item;
- for (h = extra_http_headers; h; h = h->next)
- headers = curl_slist_append(headers, h->data);
+ for_each_string_list_item(item, &extra_http_headers)
+ headers = curl_slist_append(headers, item->string);
return headers;
}