From 57702145cd9ed22b910574452098d63f4e3d2c4a Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Fri, 1 Apr 2016 18:19:59 +0200 Subject: [PATCH] statsd plugin: malloc + memset -> calloc --- src/statsd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/statsd.c b/src/statsd.c index d0a677e7..5b7a6f18 100644 --- a/src/statsd.c +++ b/src/statsd.c @@ -127,14 +127,13 @@ static statsd_metric_t *statsd_metric_lookup_unsafe (char const *name, /* {{{ */ return (NULL); } - metric = malloc (sizeof (*metric)); + metric = calloc (1, sizeof (*metric)); if (metric == NULL) { - ERROR ("statsd plugin: malloc failed."); + ERROR ("statsd plugin: calloc failed."); sfree (key_copy); return (NULL); } - memset (metric, 0, sizeof (*metric)); metric->type = type; metric->latency = NULL; -- 2.30.2