]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test/prov_config_test.c: Cleanup and fix potential leaks
authorTomas Mraz <tomas@openssl.org>
Thu, 11 Apr 2024 09:34:57 +0000 (11:34 +0200)
committerTomas Mraz <tomas@openssl.org>
Fri, 7 Jun 2024 06:42:46 +0000 (08:42 +0200)
Fixes #24106

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/24107)

test/prov_config_test.c

index 4f0cbc247b4311877f91fac0c7f0c0be51dec262..4dd9c67f7c0b8dc01d42ac1a68762d1f83c2b7e7 100644 (file)
@@ -26,15 +26,13 @@ static int test_double_config(void)
     int testresult = 0;
     EVP_MD *sha256 = NULL;
 
-    if (!TEST_ptr(configfile))
-        return 0;
     if (!TEST_ptr(ctx))
         return 0;
 
     if (!TEST_true(OSSL_LIB_CTX_load_config(ctx, configfile)))
-        return 0;
+        goto err;
     if (!TEST_true(OSSL_LIB_CTX_load_config(ctx, configfile)))
-        return 0;
+        goto err;
 
     /* Check we can actually fetch something */
     sha256 = EVP_MD_fetch(ctx, "SHA2-256", NULL);
@@ -54,9 +52,6 @@ static int test_recursive_config(void)
     int testresult = 0;
     unsigned long err;
 
-    if (!TEST_ptr(recurseconfigfile))
-        goto err;
-
     if (!TEST_ptr(ctx))
         goto err;