X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmemcachec.c;h=d7e6c286f69e0b3bb4229949dba9c8209f0941de;hb=71bbf854d3e6f8c6d6c3582527263bb01a3a7e04;hp=013b6c4ed6f83053fa42ace7848218fcaaf5448c;hpb=ae5cca244ff291c17df1cc36e28f19376958a2eb;p=collectd.git diff --git a/src/memcachec.c b/src/memcachec.c index 013b6c4e..d7e6c286 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 = (web_match_t *) 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++) @@ -272,7 +271,7 @@ static int cmc_config_add_match (web_page_t *page, /* {{{ */ match->dstype); if (match->match == NULL) { - ERROR ("memcachec plugin: tail_match_add_match_simple failed."); + ERROR ("memcachec plugin: match_create_simple failed."); cmc_web_match_free (match); return (-1); } @@ -305,13 +304,12 @@ static int cmc_config_add_page (oconfig_item_t *ci) /* {{{ */ return (-1); } - page = (web_page_t *) 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; @@ -389,7 +387,7 @@ static int cmc_config_add_page (oconfig_item_t *ci) /* {{{ */ web_page_t *prev; prev = pages_g; - while ((prev != NULL) && (prev->next != NULL)) + while (prev->next != NULL) prev = prev->next; prev->next = page; }