aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-03-03 21:14:36 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-03-03 21:16:06 +0100
commit33a0a926c59cd848f20764ecf0144f69df576c68 (patch)
treeafb9dc14ed7b76346f840e9f467467d4476a4cf1 /lib
parent3c2ef2a610814028a8dc9469b350d291327c673f (diff)
cookie: remove redundant check
... as it was already checked previously within the function. Reported-by: Dmitry-Me Closes #695
Diffstat (limited to 'lib')
-rw-r--r--lib/cookie.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/lib/cookie.c b/lib/cookie.c
index c542476a9..1fd97c013 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -1277,6 +1277,7 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere)
struct Cookie *co;
FILE *out;
bool use_stdout=FALSE;
+ char *format_ptr;
if((NULL == c) || (0 == c->numcookies))
/* If there are no known cookies, we don't write or even create any
@@ -1297,27 +1298,23 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere)
return 1; /* failure */
}
- if(c) {
- char *format_ptr;
-
- fputs("# Netscape HTTP Cookie File\n"
- "# https://curl.haxx.se/docs/http-cookies.html\n"
- "# This file was generated by libcurl! Edit at your own risk.\n\n",
- out);
+ fputs("# Netscape HTTP Cookie File\n"
+ "# https://curl.haxx.se/docs/http-cookies.html\n"
+ "# This file was generated by libcurl! Edit at your own risk.\n\n",
+ out);
- for(co = c->cookies; co; co = co->next) {
- if(!co->domain)
- continue;
- format_ptr = get_netscape_format(co);
- if(format_ptr == NULL) {
- fprintf(out, "#\n# Fatal libcurl error\n");
- if(!use_stdout)
- fclose(out);
+ for(co = c->cookies; co; co = co->next) {
+ if(!co->domain)
+ continue;
+ format_ptr = get_netscape_format(co);
+ if(format_ptr == NULL) {
+ fprintf(out, "#\n# Fatal libcurl error\n");
+ if(!use_stdout)
+ fclose(out);
return 1;
- }
- fprintf(out, "%s\n", format_ptr);
- free(format_ptr);
}
+ fprintf(out, "%s\n", format_ptr);
+ free(format_ptr);
}
if(!use_stdout)