From d0f3e34ba094e4a2aab43c867cc497d4017b2da7 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Fri, 1 Apr 2016 18:44:18 +0200 Subject: [PATCH] write_sensu plugin: malloc + memset -> calloc --- src/write_sensu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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; -- 2.30.2