diff --git a/lib/cookie.c b/lib/cookie.c index 00ea0d635..0328f20d8 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -906,32 +906,33 @@ int Curl_cookie_output(struct CookieInfo *c, char *dumphere) struct curl_slist *Curl_cookie_list(struct SessionHandle *data) { - struct curl_slist *list = NULL; - struct curl_slist *beg; - struct Cookie *c; - char *line; + struct curl_slist *list = NULL; + struct curl_slist *beg; + struct Cookie *c; + char *line; - if (data->cookies == NULL) return NULL; - if (data->cookies->numcookies == 0) return NULL; + if ((data->cookies == NULL) || + (data->cookies->numcookies == 0)) + return NULL; - c = data->cookies->cookies; + c = data->cookies->cookies; - beg = list; - while (c) { - /* 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 */ + beg = list; + while (c) { + /* 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 */ - return NULL; - } - list = curl_slist_append(list, line); - free(line); - c = c->next; - } + curl_slist_free_all(beg); /* free some memory */ + return NULL; + } + list = curl_slist_append(list, line); + free(line); + c = c->next; + } - return list; + return list; } #endif /* CURL_DISABLE_HTTP || CURL_DISABLE_COOKIES */