From 4743f198cfd38e2776bf1a8af8b31c37c4ea537e Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Mon, 28 Mar 2016 19:40:31 +0200 Subject: [PATCH] collectd-tg: malloc + memset -> calloc --- src/collectd-tg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/collectd-tg.c b/src/collectd-tg.c index 53fd3a17..04989dce 100644 --- a/src/collectd-tg.c +++ b/src/collectd-tg.c @@ -156,13 +156,12 @@ static lcc_value_list_t *create_value_list (void) /* {{{ */ lcc_value_list_t *vl; int host_num; - vl = malloc (sizeof (*vl)); + vl = calloc (1, sizeof (*vl)); if (vl == NULL) { - fprintf (stderr, "malloc failed.\n"); + fprintf (stderr, "calloc failed.\n"); return (NULL); } - memset (vl, 0, sizeof (*vl)); vl->values = calloc (/* nmemb = */ 1, sizeof (*vl->values)); if (vl->values == NULL) -- 2.30.2