From 043a41ddeeaabc192c25aa0b46ccfc4546e4d3df Mon Sep 17 00:00:00 2001 From: Hugo Landau Date: Thu, 17 Nov 2022 14:22:36 +0000 Subject: [PATCH] QUIC RX: Fix QRX packet handling refactor w.r.t. list refactor Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/19703) --- ssl/quic/quic_record_rx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ssl/quic/quic_record_rx.c b/ssl/quic/quic_record_rx.c index eb975901ed8..69a58483a45 100644 --- a/ssl/quic/quic_record_rx.c +++ b/ssl/quic/quic_record_rx.c @@ -41,8 +41,8 @@ static ossl_inline int pkt_is_marked(const uint64_t *bitf, size_t pkt_idx) typedef struct rxe_st RXE; struct rxe_st { - OSSL_LIST_MEMBER(rxe, RXE); OSSL_QRX_PKT pkt; + OSSL_LIST_MEMBER(rxe, RXE); size_t data_len, alloc_len, refcount; /* Extra fields for per-packet information. */ @@ -381,12 +381,13 @@ static RXE *qrx_resize_rxe(RXE_LIST *rxl, RXE *rxe, size_t n) * data. */ rxe2 = OPENSSL_realloc(rxe, sizeof(RXE) + n); - if (rxe2 == NULL || rxe == rxe2) { + if (rxe2 == NULL) { + /* Resize failed, restore old allocation. */ if (p == NULL) ossl_list_rxe_insert_head(rxl, rxe); else ossl_list_rxe_insert_after(rxl, p, rxe); - return rxe2; + return NULL; } if (p == NULL) -- 2.47.3