mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
use calloc instead of malloc to save a call to memset()
This commit is contained in:
parent
c06da7c84a
commit
274842ec41
@ -507,13 +507,10 @@ CURLcode Curl_ssl_initsessions(struct SessionHandle *data, long amount)
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
|
|
||||||
session = (struct curl_ssl_session *)
|
session = (struct curl_ssl_session *)
|
||||||
malloc(amount * sizeof(struct curl_ssl_session));
|
calloc(sizeof(struct curl_ssl_session), amount);
|
||||||
if(!session)
|
if(!session)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
/* "blank out" the newly allocated memory */
|
|
||||||
memset(session, 0, amount * sizeof(struct curl_ssl_session));
|
|
||||||
|
|
||||||
/* store the info in the SSL section */
|
/* store the info in the SSL section */
|
||||||
data->set.ssl.numsessions = amount;
|
data->set.ssl.numsessions = amount;
|
||||||
data->state.session = session;
|
data->state.session = session;
|
||||||
|
Loading…
Reference in New Issue
Block a user