Loading lib/cookie.c +19 −16 Original line number Diff line number Diff line Loading @@ -638,17 +638,15 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data, struct CookieInfo *inc, bool newsession) { char line[MAX_COOKIE_LINE]; struct CookieInfo *c; FILE *fp; bool fromfile=TRUE; if(NULL == inc) { /* we didn't get a struct, create one */ c = (struct CookieInfo *)malloc(sizeof(struct CookieInfo)); c = (struct CookieInfo *)calloc(1, sizeof(struct CookieInfo)); if(!c) return NULL; /* failed to get memory */ memset(c, 0, sizeof(struct CookieInfo)); c->filename = strdup(file?file:"none"); /* copy the name just in case */ } else { Loading @@ -669,6 +667,9 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data, if(fp) { char *lineptr; bool headerline; char *line = (char *)malloc(MAX_COOKIE_LINE); if(line) { while(fgets(line, MAX_COOKIE_LINE, fp)) { if(checkprefix("Set-Cookie:", line)) { /* This is a cookie line, get it! */ Loading @@ -684,6 +685,8 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data, Curl_cookie_add(data, c, headerline, lineptr, NULL, NULL); } free(line); /* free the line buffer */ } if(fromfile) fclose(fp); } Loading Loading
lib/cookie.c +19 −16 Original line number Diff line number Diff line Loading @@ -638,17 +638,15 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data, struct CookieInfo *inc, bool newsession) { char line[MAX_COOKIE_LINE]; struct CookieInfo *c; FILE *fp; bool fromfile=TRUE; if(NULL == inc) { /* we didn't get a struct, create one */ c = (struct CookieInfo *)malloc(sizeof(struct CookieInfo)); c = (struct CookieInfo *)calloc(1, sizeof(struct CookieInfo)); if(!c) return NULL; /* failed to get memory */ memset(c, 0, sizeof(struct CookieInfo)); c->filename = strdup(file?file:"none"); /* copy the name just in case */ } else { Loading @@ -669,6 +667,9 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data, if(fp) { char *lineptr; bool headerline; char *line = (char *)malloc(MAX_COOKIE_LINE); if(line) { while(fgets(line, MAX_COOKIE_LINE, fp)) { if(checkprefix("Set-Cookie:", line)) { /* This is a cookie line, get it! */ Loading @@ -684,6 +685,8 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data, Curl_cookie_add(data, c, headerline, lineptr, NULL, NULL); } free(line); /* free the line buffer */ } if(fromfile) fclose(fp); } Loading