test: fix Coverity 1454818: use after free
authorPauli <ppzgs1@gmail.com>
Thu, 18 Mar 2021 04:08:06 +0000 (14:08 +1000)
committerPauli <ppzgs1@gmail.com>
Fri, 19 Mar 2021 09:51:37 +0000 (19:51 +1000)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14597)

test/cipherlist_test.c

index 380f0727fc5af1604971b7ee7b1e5698206d0b11..9739cb58c4900197fca0f65af198fe6b1f0c8c60 100644 (file)
@@ -205,8 +205,10 @@ static int test_default_cipherlist_explicit(void)
 {
     SETUP_CIPHERLIST_TEST_FIXTURE();
     if (!TEST_true(SSL_CTX_set_cipher_list(fixture->server, "DEFAULT"))
-            || !TEST_true(SSL_CTX_set_cipher_list(fixture->client, "DEFAULT")))
+            || !TEST_true(SSL_CTX_set_cipher_list(fixture->client, "DEFAULT"))) {
         tear_down(fixture);
+        fixture = NULL;
+    }
     EXECUTE_CIPHERLIST_TEST();
     return result;
 }