summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-07-27 16:00:39 +0100
committerHugo Landau <hlandau@openssl.org>2023-08-10 18:19:50 +0100
commit3887546dcf98f1369d5a03eae9772a7deb0c9b89 (patch)
tree6560b408f4d9d14d1f7fedeb354b82f6cc9179ff /test
parent77a66117ab0c5bdd885d13dc302ace7010aca826 (diff)
QUIC CC TEST: Fix memory leak
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21565)
Diffstat (limited to 'test')
-rw-r--r--test/quic_cc_test.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/quic_cc_test.c b/test/quic_cc_test.c
index 67ab38f28a..17290ba7da 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)