summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e3db77d)
raw | patch | inline | side by side (parent: e3db77d)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Fri, 1 Apr 2016 15:55:19 +0000 (17:55 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Fri, 1 Apr 2016 15:55:19 +0000 (17:55 +0200) |
src/network.c | patch | blob | history |
diff --git a/src/network.c b/src/network.c
index ed382a06b7a73e1ef6d8253f2d2d81e9284482e5..6be4ed59521b8b80c2ec9e5220dea961a60fc8d8 100644 (file)
--- a/src/network.c
+++ b/src/network.c
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)
{