From e59371a4936f8e7e2187b09a08d34d9a4c278657 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 23 Sep 2019 17:11:22 +0200 Subject: curl: create easy handles on-demand and not ahead of time This should again enable crazy-large download ranges of the style [1-10000000] that otherwise easily ran out of memory starting in 7.66.0 when this new handle allocating scheme was introduced. Reported-by: Peter Sumatra Fixes #4393 Closes #4438 --- src/tool_operhlp.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/tool_operhlp.c') diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c index f3fcc699f..543bf4302 100644 --- a/src/tool_operhlp.c +++ b/src/tool_operhlp.c @@ -37,18 +37,20 @@ void clean_getout(struct OperationConfig *config) { - struct getout *next; - struct getout *node = config->url_list; - - while(node) { - next = node->next; - Curl_safefree(node->url); - Curl_safefree(node->outfile); - Curl_safefree(node->infile); - Curl_safefree(node); - node = next; + if(config) { + struct getout *next; + struct getout *node = config->url_list; + + while(node) { + next = node->next; + Curl_safefree(node->url); + Curl_safefree(node->outfile); + Curl_safefree(node->infile); + Curl_safefree(node); + node = next; + } + config->url_list = NULL; } - config->url_list = NULL; } bool output_expected(const char *url, const char *uploadfile) -- cgit v1.2.3