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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user