write_sensu plugin: malloc + memset -> calloc
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 16:44:18 +0000 (18:44 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 16:44:18 +0000 (18:44 +0200)
src/write_sensu.c

index aae5d8b..5e231a5 100644 (file)
@@ -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;