This reapplies the xalloc_size.cocci patch across the whole `src/` tree.

see 16cc16dd8235e7eb6c38b7abd210bd1e1d96b1d9
see 63ee0e4c01b94aee5fc6c6dd98cfc4480ae5ea46
---
 src/ncbuf.c      | 2 +-
 src/proto_quic.c | 2 +-
 src/quic_sock.c  | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/ncbuf.c b/src/ncbuf.c
index 1944cfe34..adb32b57a 100644
--- a/src/ncbuf.c
+++ b/src/ncbuf.c
@@ -726,7 +726,7 @@ struct rand_off {
 static struct rand_off *ncb_generate_rand_off(const struct ncbuf *buf)
 {
        struct rand_off *roff;
-       roff = calloc(1, sizeof(struct rand_off));
+       roff = calloc(1, sizeof(*roff));
        BUG_ON(!roff);
 
        roff->off = rand() % (ncb_size(buf));
diff --git a/src/proto_quic.c b/src/proto_quic.c
index 55aa4b50f..ab1bef18f 100644
--- a/src/proto_quic.c
+++ b/src/proto_quic.c
@@ -703,7 +703,7 @@ static int quic_alloc_dghdlrs(void)
 {
        int i;
 
-       quic_dghdlrs = calloc(global.nbthread, sizeof(struct quic_dghdlr));
+       quic_dghdlrs = calloc(global.nbthread, sizeof(*quic_dghdlrs));
        if (!quic_dghdlrs) {
                ha_alert("Failed to allocate the quic datagram handlers.\n");
                return 0;
diff --git a/src/quic_sock.c b/src/quic_sock.c
index 6207af703..a391006af 100644
--- a/src/quic_sock.c
+++ b/src/quic_sock.c
@@ -466,7 +466,8 @@ static int quic_alloc_accept_queues(void)
 {
        int i;
 
-       quic_accept_queues = calloc(global.nbthread, sizeof(struct 
quic_accept_queue));
+       quic_accept_queues = calloc(global.nbthread,
+                                   sizeof(*quic_accept_queues));
        if (!quic_accept_queues) {
                ha_alert("Failed to allocate the quic accept queues.\n");
                return 0;
-- 
2.36.1


Reply via email to