aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-02-23 15:10:18 +0000
committerSteve Holme <steve_holme@hotmail.com>2014-02-24 20:35:48 +0000
commitc27cc68815acd315c663e08ee9e3450b153f095f (patch)
tree3c8ee28c2347d069857b16259701ef911e8c2bb0 /src
parent0af2322bc6dec10612d33de4b100d5dbc7be739f (diff)
tool_operate: Moved easy handle cleanup into tool_main
Diffstat (limited to 'src')
-rw-r--r--src/tool_cfgable.c10
-rw-r--r--src/tool_main.c6
-rw-r--r--src/tool_operate.c15
3 files changed, 9 insertions, 22 deletions
diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c
index e0010a702..9eb29ddb3 100644
--- a/src/tool_cfgable.c
+++ b/src/tool_cfgable.c
@@ -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);
+ }
}
diff --git a/src/tool_main.c b/src/tool_main.c
index 009790493..7bdd253aa 100644
--- a/src/tool_main.c
+++ b/src/tool_main.c
@@ -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;
}
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 4bbf29538..25aa9413d 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -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;
}