]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC CC TEST: Fix memory leak
authorHugo Landau <hlandau@openssl.org>
Thu, 27 Jul 2023 15:00:39 +0000 (16:00 +0100)
committerHugo Landau <hlandau@openssl.org>
Thu, 10 Aug 2023 17:19:50 +0000 (18:19 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21565)

test/quic_cc_test.c

index 67ab38f28a70dafbdd34484b1809443e8adf0469..17290ba7dac892c8a45f8537eade70a7ac980e39 100644 (file)
@@ -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)