X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmatch_value.c;h=64e1136703e9aaf2833a13fea9ded807a5802199;hb=bed961ab910f1cf5d96d1e60af0227431a38bbf3;hp=9ffcecaae473b9bc24b49d721e5b2914ae4bcfbe;hpb=d6f0273b2ebae6995d69c7701838825b96e4f424;p=collectd.git diff --git a/src/match_value.c b/src/match_value.c index 9ffcecaa..64e11367 100644 --- a/src/match_value.c +++ b/src/match_value.c @@ -59,7 +59,7 @@ struct mv_match_s static void mv_free_match (mv_match_t *m) /* {{{ */ { size_t i; - + if (m == NULL) return; @@ -69,7 +69,7 @@ static void mv_free_match (mv_match_t *m) /* {{{ */ free(m->data_sources[i]); free(m->data_sources); } - + free (m); } /* }}} void mv_free_match */ @@ -200,13 +200,12 @@ static int mv_create (const oconfig_item_t *ci, void **user_data) /* {{{ */ int status; int i; - m = (mv_match_t *) malloc (sizeof (*m)); + m = calloc (1, sizeof (*m)); if (m == NULL) { - ERROR ("mv_create: malloc failed."); + ERROR ("mv_create: calloc failed."); return (-ENOMEM); } - memset (m, 0, sizeof (*m)); m->min = NAN; m->max = NAN;