aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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;
+ }
}
}
}