From: Ruben Kerkhof Date: Fri, 1 Apr 2016 16:04:51 +0000 (+0200) Subject: pinba plugin: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2~23 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=f35b2b385551bb48459fb3e513377d6ae97ace96;p=collectd.git pinba plugin: malloc + memset -> calloc --- diff --git a/src/pinba.c b/src/pinba.c index d13d047b..f6ddcdaf 100644 --- a/src/pinba.c +++ b/src/pinba.c @@ -381,14 +381,13 @@ static pinba_socket_t *pinba_socket_open (const char *node, /* {{{ */ } assert (ai_list != NULL); - s = malloc (sizeof (*s)); + s = calloc (1, sizeof (*s)); if (s == NULL) { freeaddrinfo (ai_list); - ERROR ("pinba plugin: malloc failed."); + ERROR ("pinba plugin: calloc failed."); return (NULL); } - memset (s, 0, sizeof (*s)); for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) {