From 90d0a8cec7cb81f4be783c36336de58761c488c8 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Wed, 16 Oct 2024 17:50:30 +0200 Subject: [PATCH] MINOR: quic: simplify qc_prep_pkts() exit path --- src/quic_tx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/quic_tx.c b/src/quic_tx.c index 001a745e64..cdba917b1e 100644 --- a/src/quic_tx.c +++ b/src/quic_tx.c @@ -658,6 +658,7 @@ static int qc_prep_pkts(struct quic_conn *qc, struct buffer *buf, if (err == QC_BUILD_PKT_ERR_ALLOC || err == QC_BUILD_PKT_ERR_ENCRYPT) goto leave; + first_pkt = NULL; goto out; } @@ -692,10 +693,8 @@ static int qc_prep_pkts(struct quic_conn *qc, struct buffer *buf, BUG_ON(padding && !next_qel); /* Build only one datagram when an immediate close is required. */ - if (cc) { - qc_txb_store(buf, dglen, first_pkt); + if (cc) goto out; - } /* Only one short packet by datagram when probing. */ if (probe && qel == qc->ael) @@ -742,10 +741,10 @@ static int qc_prep_pkts(struct quic_conn *qc, struct buffer *buf, TRACE_DEVEL("next encryption level", QUIC_EV_CONN_PHPKTS, qc); } + out: if (first_pkt) qc_txb_store(buf, wrlen, first_pkt); - out: if (cc && total) { BUG_ON(buf != &qc->tx.cc_buf); BUG_ON(dglen != total); -- 2.47.2