From: Ruben Kerkhof Date: Mon, 28 Mar 2016 17:42:36 +0000 (+0200) Subject: curl: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2~48 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e2fc27cdb088daf9fde56109f45ae32f9ab42607;p=collectd.git curl: malloc + memset -> calloc --- diff --git a/src/curl.c b/src/curl.c index f6127a9f..5f782074 100644 --- a/src/curl.c +++ b/src/curl.c @@ -270,13 +270,12 @@ static int cc_config_add_match (web_page_t *page, /* {{{ */ WARNING ("curl plugin: Ignoring arguments for the `Match' block."); } - match = malloc (sizeof (*match)); + match = calloc (1, sizeof (*match)); if (match == NULL) { - ERROR ("curl plugin: malloc failed."); + ERROR ("curl plugin: calloc failed."); return (-1); } - memset (match, 0, sizeof (*match)); status = 0; for (i = 0; i < ci->children_num; i++) @@ -436,13 +435,12 @@ static int cc_config_add_page (oconfig_item_t *ci) /* {{{ */ return (-1); } - page = malloc (sizeof (*page)); + page = calloc (1, sizeof (*page)); if (page == NULL) { - ERROR ("curl plugin: malloc failed."); + ERROR ("curl plugin: calloc failed."); return (-1); } - memset (page, 0, sizeof (*page)); page->url = NULL; page->user = NULL; page->pass = NULL;