From: Ruben Kerkhof Date: Fri, 1 Apr 2016 15:10:05 +0000 (+0200) Subject: memcachec plugin: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2~33 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a0bcba7486290a2cfa58deeceea9044809a14e57;p=collectd.git memcachec plugin: malloc + memset -> calloc --- 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;