From 2abb98e474cb53660ab5c0d09d80c987d58f3302 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Fri, 1 Apr 2016 15:59:07 +0200 Subject: [PATCH] ethstat plugin: malloc + memset -> calloc --- src/ethstat.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ethstat.c b/src/ethstat.c index dec14f3d..8971f4df 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); } -- 2.30.2