]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: quic: use pool_zalloc() instead of pool_alloc+memset
authorWilly Tarreau <w@1wt.eu>
Mon, 22 Mar 2021 20:13:05 +0000 (21:13 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 22 Mar 2021 22:20:21 +0000 (23:20 +0100)
Two places used to alloc then zero the area, let's have the allocator do it.

src/xprt_quic.c

index be15af90d2de32635df9b1c906a168d1feae7695..f57506ffd636a1febc9b65d376be8d4507960bb0 100644 (file)
@@ -2322,9 +2322,8 @@ struct quic_conn *new_quic_conn(uint32_t version)
 {
        struct quic_conn *quic_conn;
 
-       quic_conn = pool_alloc(pool_head_quic_conn);
+       quic_conn = pool_zalloc(pool_head_quic_conn);
        if (quic_conn) {
-               memset(quic_conn, 0, sizeof *quic_conn);
                quic_conn->version = version;
        }
 
@@ -4217,11 +4216,10 @@ static ssize_t quic_dgram_read(char *buf, size_t len, void *owner,
                int ret;
                struct quic_rx_packet *pkt;
 
-               pkt = pool_alloc(pool_head_quic_rx_packet);
+               pkt = pool_zalloc(pool_head_quic_rx_packet);
                if (!pkt)
                        goto err;
 
-               memset(pkt, 0, sizeof(*pkt));
                quic_rx_packet_refinc(pkt);
                ret = func(&pos, end, pkt, &dgram_ctx, saddr);
                if (ret == -1) {