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/ssl_sock.c b/src/ssl_sock.c
index 64c86b1..b8d6b4c 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -5107,7 +5107,7 @@
}
/* Allocate cert structure */
- ckch = calloc(1, sizeof(struct cert_key_and_chain));
+ ckch = calloc(1, sizeof(*ckch));
if (!ckch) {
ha_alert("Proxy '%s': Failed to read CA certificate file '%s' at [%s:%d]. Chain allocation failure\n",
px->id, bind_conf->ca_sign_file, bind_conf->file, bind_conf->line);