aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-05-10 14:04:06 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-05-10 14:04:06 +0000
commit5dcab07c542b9365f59e859da578dfea0c6014b5 (patch)
tree9e11090f44a02edce89418e9d466b80568eabcda
parent1f798affb91e09ddb6c36911d1d6c28386bfb69f (diff)
if a malloc fails, clear up the memory and return failure
-rw-r--r--lib/cookie.c10
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;
+ }
}
}
}