From c13a935c8bdb40daf1f7078fc81bf05b90c7cd90 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Fri, 1 Apr 2016 18:44:47 +0200 Subject: [PATCH] write_tsdb plugin: malloc + memset -> calloc --- src/write_tsdb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/write_tsdb.c b/src/write_tsdb.c index c562596b..0fa62452 100644 --- a/src/write_tsdb.c +++ b/src/write_tsdb.c @@ -579,13 +579,12 @@ static int wt_config_tsd(oconfig_item_t *ci) char callback_name[DATA_MAX_NAME_LEN]; int i; - cb = malloc(sizeof(*cb)); + cb = calloc(1, sizeof(*cb)); if (cb == NULL) { - ERROR("write_tsdb plugin: malloc failed."); + ERROR("write_tsdb plugin: calloc failed."); return -1; } - memset(cb, 0, sizeof(*cb)); cb->sock_fd = -1; cb->node = NULL; cb->service = NULL; -- 2.11.0