X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmatch_value.c;h=64e1136703e9aaf2833a13fea9ded807a5802199;hb=f81aafecc0b537b4bec734f7fdb0c8352719afee;hp=9ffcecaae473b9bc24b49d721e5b2914ae4bcfbe;hpb=7bab45b57d6ef99ae55c499c51478dd63c3b1397;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;