X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Ffilecount.c;fp=src%2Ffilecount.c;h=3b5038cde2390f036734c87cccab87f2b186146b;hb=72f3b390dff512e8d891aff6f3fba9ecaeaf970c;hp=7c96a48f4b9705a12878a2ab87dcb0d62a9dc8ba;hpb=ac7b627107467098795f0d078cdb9e72546baea8;p=collectd.git diff --git a/src/filecount.c b/src/filecount.c index 7c96a48f..3b5038cd 100644 --- a/src/filecount.c +++ b/src/filecount.c @@ -344,13 +344,12 @@ static int fc_config_add_dir (oconfig_item_t *ci) } /* Initialize `dir' */ - dir = 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)