From e2fc27cdb088daf9fde56109f45ae32f9ab42607 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Mon, 28 Mar 2016 19:42:36 +0200 Subject: [PATCH] curl: malloc + memset -> calloc --- src/curl.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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; -- 2.11.0