Skip to content
Snippets Groups Projects
Commit c27cc688 authored by Steve Holme's avatar Steve Holme
Browse files

tool_operate: Moved easy handle cleanup into tool_main

parent 0af2322b
No related branches found
No related tags found
No related merge requests found
......@@ -154,19 +154,13 @@ void config_free(struct OperationConfig *config)
{
struct OperationConfig *last = config;
/* Find the last config structure */
while(last->next)
last = last->next;
/* Free each of the structures in reverse order */
do {
while(last) {
struct OperationConfig *prev = last->prev;
if(prev)
last->easy = NULL;
free_config_fields(last);
free(last);
last = prev;
} while(last);
}
}
......@@ -172,13 +172,17 @@ static CURLcode main_init(struct GlobalConfig *config)
*/
static void main_free(struct GlobalConfig *config)
{
/* Cleanup the easy handle */
curl_easy_cleanup(config->easy);
config->easy = NULL;
/* Main cleanup */
curl_global_cleanup();
convert_cleanup();
metalink_cleanup();
/* Free the config structures */
config_free(config->first);
config_free(config->last);
config->first = NULL;
config->last = NULL;
}
......
......@@ -1772,18 +1772,10 @@ static CURLcode operate_do(struct OperationConfig *config)
dumpeasysrc(config);
#endif
return (CURLcode)res;
}
static void operate_free(struct OperationConfig *config)
{
if(config->easy) {
curl_easy_cleanup(config->easy);
config->easy = NULL;
}
/* Release metalink related resources here */
clean_metalink(config);
return (CURLcode)res;
}
CURLcode operate(struct GlobalConfig *config, int argc, argv_item_t argv[])
......@@ -1851,8 +1843,5 @@ CURLcode operate(struct GlobalConfig *config, int argc, argv_item_t argv[])
}
}
/* Perform the cleanup */
operate_free(config->first);
return result;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment