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