diff options
author | Yang Tse <yangsita@gmail.com> | 2007-04-07 04:51:35 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2007-04-07 04:51:35 +0000 |
commit | d9e89e170f0b00de8f4b36bd20a5b5ad4110366c (patch) | |
tree | a8bb7183a3104aaf5993454659f8b0e972868b6f /lib/cookie.c | |
parent | 47594be5c0d28a77f1cecf3cb7badc975f9a9297 (diff) |
fix out of memory handling issue
Diffstat (limited to 'lib/cookie.c')
-rw-r--r-- | lib/cookie.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/cookie.c b/lib/cookie.c index e64bc49e9..d25eb69c3 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -1005,13 +1005,18 @@ struct curl_slist *Curl_cookie_list(struct SessionHandle *data) /* fill the list with _all_ the cookies we know */ line = get_netscape_format(c); if (line == NULL) { - /* get_netscape_format returns null only if we run out of memory */ - - curl_slist_free_all(beg); /* free some memory */ + curl_slist_free_all(beg); return NULL; } list = curl_slist_append(list, line); free(line); + if (list == NULL) { + curl_slist_free_all(beg); + return NULL; + } + else if (beg == NULL) { + beg = list; + } c = c->next; } |