return ARES_SUCCESS; /* use localhost DNS server */
nservers = i;
- servers = calloc(sizeof(*servers), i);
+ servers = calloc(i, sizeof(struct server_state));
if (!servers)
return ARES_ENOMEM;
return;
}
}
- sendreq = calloc(sizeof(struct send_request), 1);
+ sendreq = calloc(1, sizeof(struct send_request));
if (!sendreq)
{
end_query(channel, query, ARES_ENOMEM, NULL, 0);
#endif
/* First, alloc and init a new struct for it */
- co = calloc(sizeof(struct Cookie), 1);
+ co = calloc(1, sizeof(struct Cookie));
if(!co)
return NULL; /* bail out if we're this low on memory */
bool fail = TRUE;
struct SessionHandle *data=(struct SessionHandle *)incurl;
- struct SessionHandle *outcurl = calloc(sizeof(struct SessionHandle), 1);
+ struct SessionHandle *outcurl = calloc(1, sizeof(struct SessionHandle));
if(NULL == outcurl)
return NULL; /* failure */
Curl_reset_reqproto(conn);
if(!data->state.proto.file) {
- file = calloc(sizeof(struct FILEPROTO), 1);
+ file = calloc(1, sizeof(struct FILEPROTO));
if(!file) {
free(real_path);
return CURLE_OUT_OF_MEMORY;
struct curl_httppost **last_post)
{
struct curl_httppost *post;
- post = calloc(sizeof(struct curl_httppost), 1);
+ post = calloc(1, sizeof(struct curl_httppost));
if(post) {
post->name = name;
post->namelength = (long)(name?(namelength?namelength:strlen(name)):0);
FormInfo *parent_form_info)
{
FormInfo *form_info;
- form_info = calloc(sizeof(FormInfo), 1);
+ form_info = calloc(1, sizeof(struct FormInfo));
if(form_info) {
if(value)
form_info->value = value;
/*
* We need to allocate the first struct to fill in.
*/
- first_form = calloc(sizeof(struct FormInfo), 1);
+ first_form = calloc(1, sizeof(struct FormInfo));
if(!first_form)
return CURL_FORMADD_MEMORY;
struct SessionHandle *data = conn->data;
struct FTP *ftp = data->state.proto.ftp;
if(!ftp) {
- ftp = data->state.proto.ftp = calloc(sizeof(struct FTP), 1);
+ ftp = data->state.proto.ftp = calloc(1, sizeof(struct FTP));
if(!ftp)
return CURLE_OUT_OF_MEMORY;
}
entry_len = strlen(entry_id);
/* Create a new cache entry */
- dns = calloc(sizeof(struct Curl_dns_entry), 1);
+ dns = calloc(1, sizeof(struct Curl_dns_entry));
if(!dns) {
free(entry_id);
return NULL;
else {
int h_errnop;
- buf = calloc(CURL_HOSTENT_SIZE, 1);
+ buf = calloc(1, CURL_HOSTENT_SIZE);
if(!buf)
return NULL; /* major failure */
/*
const char *hostname, int port,
const struct addrinfo *hints)
{
- struct thread_data *td = calloc(sizeof(*td), 1);
+ struct thread_data *td = calloc(1, sizeof(struct thread_data));
HANDLE thread_and_event[2] = {0};
if(!td) {
static
send_buffer *add_buffer_init(void)
{
- return calloc(sizeof(send_buffer), 1);
+ return calloc(1, sizeof(send_buffer));
}
/*
if(!data->state.proto.http) {
/* Only allocate this struct if we don't already have it! */
- http = calloc(sizeof(struct HTTP), 1);
+ http = calloc(1, sizeof(struct HTTP));
if(!http)
return CURLE_OUT_OF_MEMORY;
data->state.proto.http = http;
static int _ldap_url_parse (const struct connectdata *conn,
LDAPURLDesc **ludpp)
{
- LDAPURLDesc *ludp = calloc(sizeof(*ludp), 1);
+ LDAPURLDesc *ludp = calloc(1, sizeof(*ludp));
int rc;
*ludpp = NULL;
return there;
/* not present, add it */
- check = calloc(sizeof(struct Curl_sh_entry), 1);
+ check = calloc(1, sizeof(struct Curl_sh_entry));
if(!check)
return NULL; /* major failure */
check->easy = data;
CURLM *curl_multi_init(void)
{
- struct Curl_multi *multi = calloc(sizeof(struct Curl_multi), 1);
+ struct Curl_multi *multi = calloc(1, sizeof(struct Curl_multi));
if(!multi)
return NULL;
return CURLM_BAD_EASY_HANDLE;
/* Now, time to add an easy handle to the multi stack */
- easy = calloc(sizeof(struct Curl_one_easy), 1);
+ easy = calloc(1, sizeof(struct Curl_one_easy));
if(!easy)
return CURLM_OUT_OF_MEMORY;
struct SessionHandle *data)
{
int i;
- struct closure *cl = calloc(sizeof(struct closure), 1);
+ struct closure *cl = calloc(1, sizeof(struct closure));
struct closure *p=NULL;
struct closure *n;
if(cl) {
CURLSH *
curl_share_init(void)
{
- struct Curl_share *share = calloc(sizeof(struct Curl_share), 1);
+ struct Curl_share *share = calloc(1, sizeof(struct Curl_share));
if(share)
share->specifier |= (1<<CURL_LOCK_DATA_SHARE);
if(data->state.proto.ssh)
return CURLE_OK;
- ssh = calloc(sizeof(struct SSHPROTO), 1);
+ ssh = calloc(1, sizeof(struct SSHPROTO));
if(!ssh)
return CURLE_OUT_OF_MEMORY;
/* this is just a precaution to prevent multiple inits */
return CURLE_OK;
- session = calloc(sizeof(struct curl_ssl_session), amount);
+ session = calloc(amount, sizeof(struct curl_ssl_session));
if(!session)
return CURLE_OUT_OF_MEMORY;
Curl_ssl_free_certinfo(data);
ci->num_of_certs = num;
- table = calloc(sizeof(struct curl_slist *) * num, 1);
+ table = calloc((size_t)num, sizeof(struct curl_slist *));
if(!table)
return 1;
sessionhandle, deal with it */
Curl_reset_reqproto(conn);
- state = conn->proto.tftpc = calloc(sizeof(tftp_state_data_t), 1);
+ state = conn->proto.tftpc = calloc(1, sizeof(tftp_state_data_t));
if(!state)
return CURLE_OUT_OF_MEMORY;
if(NULL == glob_buffer)
return CURLE_OUT_OF_MEMORY;
- glob_expand = calloc(sizeof(URLGlob), 1);
+ glob_expand = calloc(1, sizeof(URLGlob));
if(NULL == glob_expand) {
free(glob_buffer);
return CURLE_OUT_OF_MEMORY;