From: Ruben Kerkhof Date: Fri, 1 Apr 2016 16:44:18 +0000 (+0200) Subject: write_sensu plugin: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d0f3e34ba094e4a2aab43c867cc497d4017b2da7;p=collectd.git write_sensu plugin: malloc + memset -> calloc --- diff --git a/src/write_sensu.c b/src/write_sensu.c index aae5d8bb..5e231a58 100644 --- a/src/write_sensu.c +++ b/src/write_sensu.c @@ -524,11 +524,10 @@ static char *replace_str(const char *str, const char *old, /* {{{ */ } else retlen = strlen(str); - ret = malloc(retlen + 1); + ret = calloc(1, retlen + 1); if (ret == NULL) return NULL; // added to original: not optimized, but keeps valgrind happy. - memset(ret, 0, retlen + 1); r = ret; p = str;