Skip to content

Commit 6a4a9f3

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge branch 'cb/curl-use-xmalloc'
HTTP transport had possible allocator/deallocator mismatch, which has been corrected. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 3507256 + f8922db commit 6a4a9f3

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

http.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static unsigned long empty_auth_useless =
150150

151151
static struct curl_slist *pragma_header;
152152
static struct curl_slist *no_pragma_header;
153-
static struct curl_slist *extra_http_headers;
153+
static struct string_list extra_http_headers = STRING_LIST_INIT_DUP;
154154

155155
static struct active_request_slot *active_queue_head;
156156

@@ -414,11 +414,9 @@ static int http_options(const char *var, const char *value, void *cb)
414414
if (!value) {
415415
return config_error_nonbool(var);
416416
} else if (!*value) {
417-
curl_slist_free_all(extra_http_headers);
418-
extra_http_headers = NULL;
417+
string_list_clear(&extra_http_headers, 0);
419418
} else {
420-
extra_http_headers =
421-
curl_slist_append(extra_http_headers, value);
419+
string_list_append(&extra_http_headers, value);
422420
}
423421
return 0;
424422
}
@@ -1202,8 +1200,7 @@ void http_cleanup(void)
12021200
#endif
12031201
curl_global_cleanup();
12041202

1205-
curl_slist_free_all(extra_http_headers);
1206-
extra_http_headers = NULL;
1203+
string_list_clear(&extra_http_headers, 0);
12071204

12081205
curl_slist_free_all(pragma_header);
12091206
pragma_header = NULL;
@@ -1627,10 +1624,11 @@ int run_one_slot(struct active_request_slot *slot,
16271624

16281625
struct curl_slist *http_copy_default_headers(void)
16291626
{
1630-
struct curl_slist *headers = NULL, *h;
1627+
struct curl_slist *headers = NULL;
1628+
const struct string_list_item *item;
16311629

1632-
for (h = extra_http_headers; h; h = h->next)
1633-
headers = curl_slist_append(headers, h->data);
1630+
for_each_string_list_item(item, &extra_http_headers)
1631+
headers = curl_slist_append(headers, item->string);
16341632

16351633
return headers;
16361634
}

0 commit comments

Comments
 (0)