X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmatch_hashed.c;h=4178d75764e94d9dca4f2b81213dbe6c4b39d60b;hb=edd9af8a874ebc9f2a7f02846807229a648917db;hp=ba0c47c3f30275ce422f30b6fa717b0bb0d761cf;hpb=21a4ddcc2d66eea59224fd95746c7533b1b1a46d;p=collectd.git diff --git a/src/match_hashed.c b/src/match_hashed.c index ba0c47c3..4178d757 100644 --- a/src/match_hashed.c +++ b/src/match_hashed.c @@ -101,13 +101,12 @@ static int mh_create (const oconfig_item_t *ci, void **user_data) /* {{{ */ mh_match_t *m; int i; - m = (mh_match_t *) malloc (sizeof (*m)); + m = calloc (1, sizeof (*m)); if (m == NULL) { - ERROR ("mh_create: malloc failed."); + ERROR ("mh_create: calloc failed."); return (-ENOMEM); } - memset (m, 0, sizeof (*m)); for (i = 0; i < ci->children_num; i++) {