X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Ffilecount.c;h=270e5d0528f567ca99307d9a01199529dcdc45b6;hb=ff9e11ade5cfabf32c63fb19fc76cbbc4186bc5b;hp=9ea8af7abe2792ebc7235094cb67f37e75a668e8;hpb=ae5cca244ff291c17df1cc36e28f19376958a2eb;p=collectd.git diff --git a/src/filecount.c b/src/filecount.c index 9ea8af7a..270e5d05 100644 --- a/src/filecount.c +++ b/src/filecount.c @@ -23,7 +23,7 @@ #include "collectd.h" #include "common.h" -#include "plugin.h" +#include "plugin.h" #include #include @@ -344,13 +344,12 @@ static int fc_config_add_dir (oconfig_item_t *ci) } /* 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) @@ -542,7 +541,7 @@ static int fc_read_dir (fc_directory_conf_t *dir) 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)