CLEANUP: Do not use a fixed type for 'sizeof' in 'calloc'
Changes performed using the following coccinelle patch:
@@
type T;
expression E;
expression t;
@@
(
t = calloc(E, sizeof(*t))
|
- t = calloc(E, sizeof(T))
+ t = calloc(E, sizeof(*t))
)
Looking through the commit history, grepping for coccinelle shows that the same
replacement with a different patch was already performed in the past in commit
02779b6263a177b1e462e53db6eaf57bcda574bc.
diff --git a/src/extcheck.c b/src/extcheck.c
index 721e49d..e6b30ff 100644
--- a/src/extcheck.c
+++ b/src/extcheck.c
@@ -274,13 +274,13 @@
}
check->curpid = NULL;
- check->envp = calloc((EXTCHK_SIZE + 1), sizeof(char *));
+ check->envp = calloc((EXTCHK_SIZE + 1), sizeof(*check->envp));
if (!check->envp) {
ha_alert("Failed to allocate memory for environment variables. Aborting\n");
goto err;
}
- check->argv = calloc(6, sizeof(char *));
+ check->argv = calloc(6, sizeof(*check->argv));
if (!check->argv) {
ha_alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id);
goto err;