X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsensors.c;h=6125d0bc1b7f49ae1d43eb2ea21e2dd69f34332c;hb=f14bb45d570e0b34bdd3a2a0cadfe414c3dfda40;hp=c678dec99c2fbdb5e544bfded5fd5a8327173c1e;hpb=0636029f3104d6975c13a03d564edc4181764571;p=collectd.git diff --git a/src/sensors.c b/src/sensors.c index c678dec9..6125d0bc 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -378,13 +378,12 @@ static int sensors_load_conf (void) continue; } - fl = (featurelist_t *) malloc (sizeof (featurelist_t)); + 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 = (featurelist_t *) malloc (sizeof (featurelist_t)); + 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;