CLEANUP: Re-apply xalloc_size.cocci (2)

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

see 16cc16dd82
see 63ee0e4c01
This commit is contained in:
Tim Duesterhus 2022-06-01 21:58:37 +02:00 committed by Christopher Faulet
parent d649b57519
commit 9fb57e8c17
3 changed files with 4 additions and 3 deletions

View 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));

View 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;

View 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;