summaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2019-11-06 10:04:55 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-11-07 14:38:32 +0900
commit4d17fd253fbba05c643593bcb86515683badb03f (patch)
tree295e535ac322fae24ceb885f57dcef29938b0853 /environment.c
parenthttp: use xmalloc with cURL (diff)
downloadtgif-4d17fd253fbba05c643593bcb86515683badb03f.tar.xz
remote-curl: unbreak http.extraHeader with custom allocators
In 93b980e58f5 (http: use xmalloc with cURL, 2019-08-15), we started to ask cURL to use `xmalloc()`, and if compiled with nedmalloc, that means implicitly a different allocator than the system one. Which means that all of cURL's allocations and releases now _need_ to use that allocator. However, the `http_options()` function used `slist_append()` to add any configured extra HTTP header(s) _before_ asking cURL to use `xmalloc()`, and `http_cleanup()` would release them _afterwards_, i.e. in the presence of custom allocators, cURL would attempt to use the wrong allocator to release the memory. A naïve attempt at fixing this would move the call to `curl_global_init()` _before_ the config is parsed (i.e. before that call to `slist_append()`). However, that does not work, as we _also_ parse the config setting `http.sslbackend` and if found, call `curl_global_sslset()` which *must* be called before `curl_global_init()`, for details see: https://curl.haxx.se/libcurl/c/curl_global_sslset.html So let's instead make the config parsing entirely independent from cURL's data structures. Incidentally, this deletes two more lines than it introduces, which is nice. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'environment.c')
0 files changed, 0 insertions, 0 deletions