X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmatch_empty_counter.c;h=8f99a6d163cc0c4547fa516d30816e8d50181bc7;hb=edd9af8a874ebc9f2a7f02846807229a648917db;hp=abde2b3495f818bf25b3188b4dadfd090210d6c9;hpb=0c004681a480e919b779584814eb396f6e6948ca;p=collectd.git diff --git a/src/match_empty_counter.c b/src/match_empty_counter.c index abde2b34..8f99a6d1 100644 --- a/src/match_empty_counter.c +++ b/src/match_empty_counter.c @@ -46,13 +46,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 +79,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);