projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
129fdc5
)
memcachec plugin: malloc + memset -> calloc
author
Ruben Kerkhof
<ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 15:10:05 +0000
(17:10 +0200)
committer
Ruben Kerkhof
<ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 15:10:05 +0000
(17:10 +0200)
src/memcachec.c
patch
|
blob
|
history
diff --git
a/src/memcachec.c
b/src/memcachec.c
index
a23d495
..
1e1d42d
100644
(file)
--- a/
src/memcachec.c
+++ b/
src/memcachec.c
@@
-206,13
+206,12
@@
static int cmc_config_add_match (web_page_t *page, /* {{{ */
WARNING ("memcachec plugin: Ignoring arguments for the `Match' block.");
}
WARNING ("memcachec plugin: Ignoring arguments for the `Match' block.");
}
- match =
malloc (
sizeof (*match));
+ match =
calloc (1,
sizeof (*match));
if (match == NULL)
{
if (match == NULL)
{
- ERROR ("memcachec plugin:
m
alloc failed.");
+ ERROR ("memcachec plugin:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (match, 0, sizeof (*match));
status = 0;
for (i = 0; i < ci->children_num; i++)
status = 0;
for (i = 0; i < ci->children_num; i++)
@@
-305,13
+304,12
@@
static int cmc_config_add_page (oconfig_item_t *ci) /* {{{ */
return (-1);
}
return (-1);
}
- page =
malloc (
sizeof (*page));
+ page =
calloc (1,
sizeof (*page));
if (page == NULL)
{
if (page == NULL)
{
- ERROR ("memcachec plugin:
m
alloc failed.");
+ ERROR ("memcachec plugin:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (page, 0, sizeof (*page));
page->server = NULL;
page->key = NULL;
page->server = NULL;
page->key = NULL;