X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ffilecount.c;h=270e5d0528f567ca99307d9a01199529dcdc45b6;hb=8361c1e963f9184c3c4d87197fd6996d667cdb3f;hp=03c018b20de938826fdf7b4c073b58ea4b1156ee;hpb=9c9a53b10ead3ee8103f625ed47066df2c9d5b87;p=collectd.git diff --git a/src/filecount.c b/src/filecount.c index 03c018b2..270e5d05 100644 --- a/src/filecount.c +++ b/src/filecount.c @@ -18,12 +18,12 @@ * * Authors: * Alessandro Iurlano - * Florian octo Forster + * Florian octo Forster **/ #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)