summaryrefslogtreecommitdiff
path: root/lib/cookie.c
diff options
context:
space:
mode:
authorMichael Wallner <mike@php.net>2019-02-25 19:05:02 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-02-26 10:07:58 +0100
commit8eddb8f4259193633cfc95a42603958a89b31de5 (patch)
treeaea533f2af2414ad06f24a5d216df16d1d8fa56f /lib/cookie.c
parent8a1948283aa2d0b452b3ee2954c49b6a765a3e1a (diff)
downloadcurl-8eddb8f4259193633cfc95a42603958a89b31de5.tar.gz
cookies: fix NULL dereference if flushing cookies with no CookieInfo set
Regression brought by a52e46f3900fb0 (shipped in 7.63.0) Closes #3613
Diffstat (limited to 'lib/cookie.c')
-rw-r--r--lib/cookie.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/cookie.c b/lib/cookie.c
index 3a3f45de3..a58ce2b35 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -1542,7 +1542,8 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere)
struct Cookie **array;
/* at first, remove expired cookies */
- remove_expired(c);
+ if(c)
+ remove_expired(c);
if(!strcmp("-", dumphere)) {
/* use stdout */
@@ -1561,7 +1562,7 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere)
"# This file was generated by libcurl! Edit at your own risk.\n\n",
out);
- if(c->numcookies) {
+ if(c && c->numcookies) {
array = malloc(sizeof(struct Cookie *) * c->numcookies);
if(!array) {
if(!use_stdout)