From: Ruben Kerkhof Date: Fri, 1 Apr 2016 16:15:44 +0000 (+0200) Subject: sensors plugin: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2~17 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=dc3637c5113c79e83d8d104c88c9cc5057dc9dcb;p=collectd.git sensors plugin: malloc + memset -> calloc --- 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;