From dc3637c5113c79e83d8d104c88c9cc5057dc9dcb Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Fri, 1 Apr 2016 18:15:44 +0200 Subject: [PATCH] sensors plugin: malloc + memset -> calloc --- src/sensors.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/sensors.c b/src/sensors.c index 3b453b15..6125d0bc 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -378,13 +378,12 @@ static int sensors_load_conf (void) continue; } - fl = malloc (sizeof (*fl)); + fl = calloc (1, sizeof (*fl)); if (fl == NULL) { - ERROR ("sensors plugin: malloc failed."); + ERROR ("sensors plugin: calloc failed."); continue; } - memset (fl, '\0', sizeof (featurelist_t)); fl->chip = chip; fl->data = feature; @@ -435,13 +434,12 @@ static int sensors_load_conf (void) && (subfeature->type != SENSORS_SUBFEATURE_POWER_INPUT)) continue; - fl = malloc (sizeof (*fl)); + fl = calloc (1, sizeof (*fl)); if (fl == NULL) { - ERROR ("sensors plugin: malloc failed."); + ERROR ("sensors plugin: calloc failed."); continue; } - memset (fl, '\0', sizeof (featurelist_t)); fl->chip = chip; fl->feature = feature; -- 2.11.0