From: Ruben Kerkhof Date: Mon, 28 Mar 2016 17:40:31 +0000 (+0200) Subject: collectd-tg: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2~49 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4743f198cfd38e2776bf1a8af8b31c37c4ea537e;p=collectd.git collectd-tg: malloc + memset -> calloc --- 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)