projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8bffdff
)
nut plugin: malloc + memset -> calloc
author
Ruben Kerkhof
<ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 15:59:27 +0000
(17:59 +0200)
committer
Ruben Kerkhof
<ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 15:59:27 +0000
(17:59 +0200)
src/nut.c
patch
|
blob
|
history
diff --git
a/src/nut.c
b/src/nut.c
index
9540d7c
..
17eb1b9
100644
(file)
--- a/
src/nut.c
+++ b/
src/nut.c
@@
-80,13
+80,12
@@
static int nut_add_ups (const char *name)
DEBUG ("nut plugin: nut_add_ups (name = %s);", name);
- ups =
malloc (
sizeof (*ups));
+ ups =
calloc (1,
sizeof (*ups));
if (ups == NULL)
{
- ERROR ("nut plugin: nut_add_ups:
m
alloc failed.");
+ ERROR ("nut plugin: nut_add_ups:
c
alloc failed.");
return (1);
}
- memset (ups, '\0', sizeof (nut_ups_t));
status = upscli_splitname (name, &ups->upsname, &ups->hostname,
&ups->port);