projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1646 from rubenk/cleanup-malloc-calls
[collectd.git]
/
src
/
filecount.c
diff --git
a/src/filecount.c
b/src/filecount.c
index
47f99e9
..
3b5038c
100644
(file)
--- a/
src/filecount.c
+++ b/
src/filecount.c
@@
-18,7
+18,7
@@
*
* Authors:
* Alessandro Iurlano <alessandro.iurlano at gmail.com>
*
* Authors:
* Alessandro Iurlano <alessandro.iurlano at gmail.com>
- * Florian octo Forster <octo at
verplant
.org>
+ * Florian octo Forster <octo at
collectd
.org>
**/
#include "collectd.h"
**/
#include "collectd.h"
@@
-344,18
+344,18
@@
static int fc_config_add_dir (oconfig_item_t *ci)
}
/* Initialize `dir' */
}
/* Initialize `dir' */
- dir =
(fc_directory_conf_t *) malloc (
sizeof (*dir));
+ dir =
calloc (1,
sizeof (*dir));
if (dir == NULL)
{
if (dir == NULL)
{
- ERROR ("filecount plugin:
m
alloc failed.");
+ ERROR ("filecount plugin:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (dir, 0, sizeof (*dir));
dir->path = strdup (ci->values[0].value.string);
if (dir->path == NULL)
{
ERROR ("filecount plugin: strdup failed.");
dir->path = strdup (ci->values[0].value.string);
if (dir->path == NULL)
{
ERROR ("filecount plugin: strdup failed.");
+ sfree (dir);
return (-1);
}
return (-1);
}