aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-10-11 19:41:30 +0200
committerYang Tse <yangsita@gmail.com>2011-10-11 19:41:30 +0200
commit584dc8b8af862f7f47a3a9f02f874ac0bd0076be (patch)
tree5e5ff41b3862251704b8f46f36bcf9052ad48e52 /lib/url.c
parenta84b8a39224d0c668d80fed561bc89b4144edbb4 (diff)
OOM handling/cleanup slight adjustments
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/url.c b/lib/url.c
index 7813b8285..7eb59f5bb 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -458,6 +458,7 @@ CURLcode Curl_close(struct SessionHandle *data)
/* free the connection cache if allocated privately */
Curl_rm_connc(data->state.connc);
+ data->state.connc = NULL;
}
}
@@ -618,13 +619,19 @@ CURLcode Curl_ch_connc(struct SessionHandle *data,
curl_multi_cleanup(). */
void Curl_rm_connc(struct conncache *c)
{
+ if(!c)
+ return;
+
if(c->connects) {
long i;
- for(i = 0; i < c->num; ++i)
+ for(i = 0; i < c->num; ++i) {
conn_free(c->connects[i]);
-
+ c->connects[i] = NULL;
+ }
free(c->connects);
+ c->connects = NULL;
}
+ c->num = 0;
free(c);
}
@@ -1258,10 +1265,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* append the cookie file name to the list of file names, and deal with
them later */
cl = curl_slist_append(data->change.cookielist, argptr);
-
- if(!cl)
+ if(!cl) {
+ curl_slist_free_all(data->change.cookielist);
+ data->change.cookielist = NULL;
return CURLE_OUT_OF_MEMORY;
-
+ }
data->change.cookielist = cl; /* store the list for later use */
}
break;