From: Tim Duesterhus Date: Wed, 1 Jun 2022 19:58:37 +0000 (+0200) Subject: CLEANUP: Re-apply xalloc_size.cocci (2) X-Git-Tag: v2.7-dev1~118 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9fb57e8c175a0b852b06a0780f48eb8eaf321a47;p=thirdparty%2Fhaproxy.git CLEANUP: Re-apply xalloc_size.cocci (2) This reapplies the xalloc_size.cocci patch across the whole `src/` tree. see 16cc16dd8235e7eb6c38b7abd210bd1e1d96b1d9 see 63ee0e4c01b94aee5fc6c6dd98cfc4480ae5ea46 --- diff --git a/src/ncbuf.c b/src/ncbuf.c index 1944cfe34f..adb32b57a9 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 55aa4b50fe..ab1bef18f0 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 6207af7034..a391006aff 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;