From a0bcba7486290a2cfa58deeceea9044809a14e57 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Fri, 1 Apr 2016 17:10:05 +0200 Subject: [PATCH] memcachec plugin: malloc + memset -> calloc --- src/memcachec.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/memcachec.c b/src/memcachec.c index a23d4956..1e1d42dc 100644 --- a/src/memcachec.c +++ b/src/memcachec.c @@ -206,13 +206,12 @@ static int cmc_config_add_match (web_page_t *page, /* {{{ */ WARNING ("memcachec plugin: Ignoring arguments for the `Match' block."); } - match = malloc (sizeof (*match)); + match = calloc (1, sizeof (*match)); if (match == NULL) { - ERROR ("memcachec plugin: malloc failed."); + ERROR ("memcachec plugin: calloc failed."); return (-1); } - memset (match, 0, sizeof (*match)); status = 0; for (i = 0; i < ci->children_num; i++) @@ -305,13 +304,12 @@ static int cmc_config_add_page (oconfig_item_t *ci) /* {{{ */ return (-1); } - page = malloc (sizeof (*page)); + page = calloc (1, sizeof (*page)); if (page == NULL) { - ERROR ("memcachec plugin: malloc failed."); + ERROR ("memcachec plugin: calloc failed."); return (-1); } - memset (page, 0, sizeof (*page)); page->server = NULL; page->key = NULL; -- 2.30.2