]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix potential memory leak in test_bad_dtls
authorAmir Mohammadi <amiremohamadi@yahoo.com>
Wed, 22 May 2024 16:18:51 +0000 (19:48 +0330)
committerMatt Caswell <matt@openssl.org>
Wed, 29 May 2024 12:43:22 +0000 (13:43 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24464)

(cherry picked from commit abe05fda8bdbfb35de7420cab31d5e459fabc874)

test/bad_dtls_test.c

index 7b50ee0545f20cbaa821fb5d34a06652628cc9a1..06dc480b799969125a1d348f1ad889169332fc36 100644 (file)
@@ -504,7 +504,6 @@ static int test_bad_dtls(void)
     if (!TEST_ptr(con)
             || !TEST_true(SSL_set_session(con, sess)))
         goto end;
-    SSL_SESSION_free(sess);
 
     rbio = BIO_new(BIO_s_mem());
     wbio = BIO_new(BIO_s_mem());
@@ -592,6 +591,7 @@ static int test_bad_dtls(void)
     testresult = 1;
 
  end:
+    SSL_SESSION_free(sess);
     BIO_free(rbio);
     BIO_free(wbio);
     SSL_free(con);