diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-05-10 14:04:06 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-05-10 14:04:06 +0000 |
commit | 5dcab07c542b9365f59e859da578dfea0c6014b5 (patch) | |
tree | 9e11090f44a02edce89418e9d466b80568eabcda | |
parent | 1f798affb91e09ddb6c36911d1d6c28386bfb69f (diff) |
if a malloc fails, clear up the memory and return failure
-rw-r--r-- | lib/cookie.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/cookie.c b/lib/cookie.c index 097a7d03b..41f14011f 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -705,6 +705,16 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, /* point the main to us */ mainco = newco; } + else { + /* failure, clear up the allocated chain and return NULL */ + while(mainco) { + co = mainco->next; + free(mainco); + mainco = co; + } + + return NULL; + } } } } |