mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
use calloc instead of malloc and we won't have to memset() the struct
This commit is contained in:
parent
1056d2d22d
commit
7d8cd5906c
@ -158,13 +158,10 @@ Curl_cookie_add(struct SessionHandle *data,
|
|||||||
bool badcookie = FALSE; /* cookies are good by default. mmmmm yummy */
|
bool badcookie = FALSE; /* cookies are good by default. mmmmm yummy */
|
||||||
|
|
||||||
/* First, alloc and init a new struct for it */
|
/* First, alloc and init a new struct for it */
|
||||||
co = (struct Cookie *)malloc(sizeof(struct Cookie));
|
co = (struct Cookie *)calloc(sizeof(struct Cookie), 1);
|
||||||
if(!co)
|
if(!co)
|
||||||
return NULL; /* bail out if we're this low on memory */
|
return NULL; /* bail out if we're this low on memory */
|
||||||
|
|
||||||
/* clear the whole struct first */
|
|
||||||
memset(co, 0, sizeof(struct Cookie));
|
|
||||||
|
|
||||||
if(httpheader) {
|
if(httpheader) {
|
||||||
/* This line was read off a HTTP-header */
|
/* This line was read off a HTTP-header */
|
||||||
char *sep;
|
char *sep;
|
||||||
|
Loading…
Reference in New Issue
Block a user