coccinelle: add reallocarray() coccinelle script

Let's systematically make use of reallocarray() whereever we invoke
realloc() with a product of two values.
This commit is contained in:
Lennart Poettering
2018-03-02 12:39:07 +01:00
parent 3209c8e650
commit 62d74c78b5
16 changed files with 56 additions and 37 deletions
+1 -1
View File
@@ -721,7 +721,7 @@ char **replace_env_argv(char **argv, char **env) {
q = strv_length(m);
l = l + q - 1;
w = realloc(ret, sizeof(char*) * (l+1));
w = reallocarray(ret, l + 1, sizeof(char *));
if (!w) {
ret[k] = NULL;
strv_free(ret);