]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: Re-apply xalloc_size.cocci (2)
authorTim Duesterhus <tim@bastelstu.be>
Wed, 1 Jun 2022 19:58:37 +0000 (21:58 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 2 Jun 2022 12:12:18 +0000 (14:12 +0200)
This reapplies the xalloc_size.cocci patch across the whole `src/` tree.

see 16cc16dd8235e7eb6c38b7abd210bd1e1d96b1d9
see 63ee0e4c01b94aee5fc6c6dd98cfc4480ae5ea46

src/ncbuf.c
src/proto_quic.c
src/quic_sock.c

index 1944cfe34fa158e549279fca5174f8b45431f9a6..adb32b57a9d1e1fac84e94be5fc3eccff08345f8 100644 (file)
@@ -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));
index 55aa4b50fe40041e3b2994038d9d2504f8908705..ab1bef18f0ccb4cbe9307cf240ebcdc90a5666e3 100644 (file)
@@ -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;
index 6207af7034ad4cbc09bfb2a222b49da1b72cfbb0..a391006aff020bd6e03617374a527011c5eacb9e 100644 (file)
@@ -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;