1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-23 00:28:48 -05:00

Use calloc() instead.

This commit is contained in:
Gisle Vanem 2006-07-21 04:19:44 +00:00
parent 27c0b43897
commit e40641bf7c

View File

@ -369,13 +369,10 @@ CURLcode Curl_open(struct SessionHandle **curl)
/* create an array with connection data struct pointers */ /* create an array with connection data struct pointers */
data->state.numconnects = 5; /* hard-coded right now */ data->state.numconnects = 5; /* hard-coded right now */
data->state.connects = (struct connectdata **) data->state.connects = (struct connectdata **)
malloc(sizeof(struct connectdata *) * data->state.numconnects); calloc(sizeof(struct connectdata *) * data->state.numconnects, 1);
if(!data->state.connects) if(!data->state.connects)
res = CURLE_OUT_OF_MEMORY; res = CURLE_OUT_OF_MEMORY;
else
memset(data->state.connects, 0,
sizeof(struct connectdata *)*data->state.numconnects);
/* most recent connection is not yet defined */ /* most recent connection is not yet defined */
data->state.lastconnect = -1; data->state.lastconnect = -1;