From: Ruben Kerkhof Date: Fri, 1 Apr 2016 16:44:47 +0000 (+0200) Subject: write_tsdb plugin: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=c13a935c8bdb40daf1f7078fc81bf05b90c7cd90;p=collectd.git write_tsdb plugin: malloc + memset -> calloc --- 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;