projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d741287
)
sensors plugin: malloc + memset -> calloc
author
Ruben Kerkhof
<ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 16:15:44 +0000
(18:15 +0200)
committer
Ruben Kerkhof
<ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 16:15:44 +0000
(18:15 +0200)
src/sensors.c
patch
|
blob
|
history
diff --git
a/src/sensors.c
b/src/sensors.c
index
3b453b1
..
6125d0b
100644
(file)
--- a/
src/sensors.c
+++ b/
src/sensors.c
@@
-378,13
+378,12
@@
static int sensors_load_conf (void)
continue;
}
continue;
}
- fl =
malloc (
sizeof (*fl));
+ fl =
calloc (1,
sizeof (*fl));
if (fl == NULL)
{
if (fl == NULL)
{
- ERROR ("sensors plugin:
m
alloc failed.");
+ ERROR ("sensors plugin:
c
alloc failed.");
continue;
}
continue;
}
- memset (fl, '\0', sizeof (featurelist_t));
fl->chip = chip;
fl->data = feature;
fl->chip = chip;
fl->data = feature;
@@
-435,13
+434,12
@@
static int sensors_load_conf (void)
&& (subfeature->type != SENSORS_SUBFEATURE_POWER_INPUT))
continue;
&& (subfeature->type != SENSORS_SUBFEATURE_POWER_INPUT))
continue;
- fl =
malloc (
sizeof (*fl));
+ fl =
calloc (1,
sizeof (*fl));
if (fl == NULL)
{
if (fl == NULL)
{
- ERROR ("sensors plugin:
m
alloc failed.");
+ ERROR ("sensors plugin:
c
alloc failed.");
continue;
}
continue;
}
- memset (fl, '\0', sizeof (featurelist_t));
fl->chip = chip;
fl->feature = feature;
fl->chip = chip;
fl->feature = feature;