From b59a0c002d8e0c58a3eeb0c82eb01026395b6b7d Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Mon, 28 Mar 2016 19:50:38 +0200 Subject: [PATCH] curl_json: malloc + memset -> calloc --- src/curl_json.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/curl_json.c b/src/curl_json.c index 4fa6f33b..33b1a6fe 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -474,13 +474,12 @@ static int cj_config_add_key (cj_t *db, /* {{{ */ return (-1); } - key = malloc (sizeof (*key)); + key = calloc (1, sizeof (*key)); if (key == NULL) { - ERROR ("curl_json plugin: malloc failed."); + ERROR ("curl_json plugin: calloc failed."); return (-1); } - memset (key, 0, sizeof (*key)); key->magic = CJ_KEY_MAGIC; if (strcasecmp ("Key", ci->key) == 0) @@ -667,13 +666,12 @@ static int cj_config_add_url (oconfig_item_t *ci) /* {{{ */ return (-1); } - db = malloc (sizeof (*db)); + db = calloc (1, sizeof (*db)); if (db == NULL) { - ERROR ("curl_json plugin: malloc failed."); + ERROR ("curl_json plugin: calloc failed."); return (-1); } - memset (db, 0, sizeof (*db)); db->timeout = -1; -- 2.11.0