diff options
author | Yang Tse <yangsita@gmail.com> | 2011-09-24 05:32:51 +0200 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2011-09-24 05:33:41 +0200 |
commit | 081e289315643339737c667d6586c27257b89634 (patch) | |
tree | 00fc697f7ce6d6705068653f4126eaf514550f68 /src/tool_cfgable.c | |
parent | 5f0764870f5710f58f308f62f46fca7b97d75c2b (diff) | |
download | curl-081e289315643339737c667d6586c27257b89634.tar.gz |
curl tool: fix some OOM handling issues
Diffstat (limited to 'src/tool_cfgable.c')
-rw-r--r-- | src/tool_cfgable.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c index 2ec57cc32..8059fa079 100644 --- a/src/tool_cfgable.c +++ b/src/tool_cfgable.c @@ -31,6 +31,8 @@ void free_config_fields(struct Configurable *config) { + struct getout *urlnode; + if(config->easy) { curl_easy_cleanup(config->easy); config->easy = NULL; @@ -65,10 +67,19 @@ void free_config_fields(struct Configurable *config) Curl_safefree(config->netrc_file); - /* config->url_list not handled */ - /* config->url_last not handled */ - /* config->url_get not handled */ - /* config->url_out not handled */ + urlnode = config->url_list; + while(urlnode) { + struct getout *next = urlnode->next; + Curl_safefree(urlnode->url); + Curl_safefree(urlnode->outfile); + Curl_safefree(urlnode->infile); + Curl_safefree(urlnode); + urlnode = next; + } + config->url_list = NULL; + config->url_last = NULL; + config->url_get = NULL; + config->url_out = NULL; Curl_safefree(config->cipher_list); Curl_safefree(config->cert); @@ -81,18 +92,17 @@ void free_config_fields(struct Configurable *config) Curl_safefree(config->key_passwd); Curl_safefree(config->pubkey); Curl_safefree(config->hostpubmd5); - - /* config->engine not handled */ + Curl_safefree(config->engine); Curl_safefree(config->customrequest); Curl_safefree(config->krblevel); Curl_safefree(config->trace_dump); - /* config->trace_stream not handled */ + config->trace_stream = NULL; /* closed elsewhere when appropriate */ Curl_safefree(config->writeout); - /* config->errors not handled */ + config->errors = NULL; /* closed elsewhere when appropriate */ curl_slist_free_all(config->quote); curl_slist_free_all(config->postquote); @@ -118,7 +128,6 @@ void free_config_fields(struct Configurable *config) Curl_safefree(config->libcurl); - /* config->outs not handled */ - + config->outs = NULL; /* closed elsewhere when appropriate */ } |