From: Hugo Landau Date: Thu, 27 Jul 2023 15:00:39 +0000 (+0100) Subject: QUIC CC TEST: Fix memory leak X-Git-Tag: openssl-3.2.0-alpha1~236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3887546dcf98f1369d5a03eae9772a7deb0c9b89;p=thirdparty%2Fopenssl.git QUIC CC TEST: Fix memory leak Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/21565) --- diff --git a/test/quic_cc_test.c b/test/quic_cc_test.c index 67ab38f28a7..17290ba7dac 100644 --- a/test/quic_cc_test.c +++ b/test/quic_cc_test.c @@ -150,7 +150,7 @@ static int net_sim_send(struct net_sim *s, size_t sz) * increase our spare capacity. */ if (!TEST_true(net_sim_process(s, 0))) - return 0; + goto err; /* Do we have room for the packet in the network? */ success = (sz <= s->spare_capacity); @@ -185,12 +185,16 @@ static int net_sim_send(struct net_sim *s, size_t sz) pkt->size = sz; if (!TEST_true(s->ccm->on_data_sent(s->cc, sz))) - return 0; + goto err; if (!TEST_true(ossl_pqueue_NET_PKT_push(s->pkts, pkt, &pkt->idx))) - return 0; + goto err; return 1; + +err: + OPENSSL_free(pkt); + return 0; } static int net_sim_process_one(struct net_sim *s, int skip_forward)