X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fethstat.c;h=e10021c581155e4fe3887c8ecaaf4fbf4bbeee94;hp=a30a5d155243bb193892455dc56afe8bbc5d5c36;hb=38909dcf1dcb596c5f525c6bb25cf89c046013b5;hpb=65c20e41cfad6e7ab024983f561835fd347124ce diff --git a/src/ethstat.c b/src/ethstat.c index a30a5d15..e10021c5 100644 --- a/src/ethstat.c +++ b/src/ethstat.c @@ -104,14 +104,13 @@ static int ethstat_add_map (const oconfig_item_t *ci) /* {{{ */ return (ENOMEM); } - map = malloc (sizeof (*map)); + map = calloc (1, sizeof (*map)); if (map == NULL) { sfree (key); - ERROR ("ethstat plugin: malloc(3) failed."); + ERROR ("ethstat plugin: calloc failed."); return (ENOMEM); } - memset (map, 0, sizeof (*map)); sstrncpy (map->type, ci->values[1].value.string, sizeof (map->type)); if (ci->values_num == 3) @@ -273,7 +272,7 @@ static int ethstat_read_interface (char *device) close (fd); sfree (strings); sfree (stats); - ERROR("ethstat plugin: malloc(3) failed."); + ERROR("ethstat plugin: malloc failed."); return (-1); }