if ((type != SOCKENT_TYPE_CLIENT) && (type != SOCKENT_TYPE_SERVER))
return (NULL);
- se = malloc (sizeof (*se));
+ se = calloc (1, sizeof (*se));
if (se == NULL)
return (NULL);
- memset (se, 0, sizeof (*se));
se->type = type;
se->node = NULL;
continue;
}
- client->addr = malloc (sizeof (*client->addr));
+ client->addr = calloc (1, sizeof (*client->addr));
if (client->addr == NULL)
{
- ERROR ("network plugin: malloc failed.");
+ ERROR ("network plugin: calloc failed.");
close (client->fd);
client->fd = -1;
continue;
}
- memset (client->addr, 0, sizeof (*client->addr));
assert (sizeof (*client->addr) >= ai_ptr->ai_addrlen);
memcpy (client->addr, ai_ptr->ai_addr, ai_ptr->ai_addrlen);
client->addrlen = ai_ptr->ai_addrlen;
* these entries in the dispatch thread but put them in
* another list, so we don't have to allocate more and
* more of these structures. */
- ent = malloc (sizeof (*ent));
+ ent = calloc (1, sizeof (*ent));
if (ent == NULL)
{
- ERROR ("network plugin: malloc failed.");
+ ERROR ("network plugin: calloc failed.");
status = ENOMEM;
break;
}
- memset (ent, 0, sizeof (receive_list_entry_t));
+
ent->data = malloc (*ent->data);
if (ent->data == NULL)
{