diff --git a/src/filecount.c b/src/filecount.c
index 9ea8af7abe2792ebc7235094cb67f37e75a668e8..c81fdc250c9840901cafeb2f7a09098963bed105 100644 (file)
--- a/src/filecount.c
+++ b/src/filecount.c
#include "collectd.h"
#include "common.h"
-#include "plugin.h"
+#include "plugin.h"
#include <sys/types.h>
#include <sys/stat.h>
}
/* Initialize `dir' */
- dir = (fc_directory_conf_t *) malloc (sizeof (*dir));
+ dir = calloc (1, sizeof (*dir));
if (dir == NULL)
{
- ERROR ("filecount plugin: malloc failed.");
+ ERROR ("filecount plugin: calloc failed.");
return (-1);
}
- memset (dir, 0, sizeof (*dir));
dir->path = strdup (ci->values[0].value.string);
if (dir->path == NULL)
{
fc_directory_conf_t **temp;
- temp = (fc_directory_conf_t **) realloc (directories,
+ temp = realloc (directories,
sizeof (*directories) * (directories_num + 1));
if (temp == NULL)
{
if (dir->mtime != 0)
dir->now = time (NULL);
-
+
status = walk_directory (dir->path, fc_read_dir_callback, dir,
/* include hidden */ (dir->options & FC_HIDDEN) ? 1 : 0);
if (status != 0)