X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmatch_empty_counter.c;h=eba6a58ea272445b98987dc3ca0c6d3cbc3beece;hb=4511e92b464cb3451297872fd00e039d59984573;hp=abde2b3495f818bf25b3188b4dadfd090210d6c9;hpb=59547eb66a3743ca0b458222d7a4318f3e659a60;p=collectd.git diff --git a/src/match_empty_counter.c b/src/match_empty_counter.c index abde2b34..eba6a58e 100644 --- a/src/match_empty_counter.c +++ b/src/match_empty_counter.c @@ -26,7 +26,6 @@ #include "collectd.h" #include "common.h" -#include "utils_cache.h" #include "filter_chain.h" /* @@ -46,13 +45,12 @@ static int mec_create (const oconfig_item_t *ci, void **user_data) /* {{{ */ { mec_match_t *m; - m = (mec_match_t *) malloc (sizeof (*m)); + m = calloc (1, sizeof (*m)); if (m == NULL) { - ERROR ("mec_create: malloc failed."); + ERROR ("mec_create: calloc failed."); return (-ENOMEM); } - memset (m, 0, sizeof (*m)); if (ci->children_num != 0) { @@ -80,7 +78,7 @@ static int mec_match (const data_set_t __attribute__((unused)) *ds, /* {{{ */ { int num_counters; int num_empty; - int i; + size_t i; if ((user_data == NULL) || (*user_data == NULL)) return (-1);