]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test: fix coverity 1414449 & 1414471: resource leak
authorPauli <ppzgs1@gmail.com>
Thu, 18 Mar 2021 00:45:35 +0000 (10:45 +1000)
committerPauli <ppzgs1@gmail.com>
Sat, 20 Mar 2021 00:07:59 +0000 (10:07 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14596)

test/shlibloadtest.c

index c879e9a01e62f2821340bdf95e6de64ec0719e49..8d3c87d36cf8fca8ac2c6d6cd852cedbde58fff1 100644 (file)
@@ -208,12 +208,14 @@ static int test_lib(void)
         fprintf(stderr, "Failed to close libcrypto\n");
         goto end;
     }
+    cryptolib = SD_INIT;
 
     if (test_type == CRYPTO_FIRST || test_type == SSL_FIRST) {
         if (!sd_close(ssllib)) {
             fprintf(stderr, "Failed to close libssl\n");
             goto end;
         }
+        ssllib = SD_INIT;
     }
 
 # if defined(OPENSSL_NO_PINSHARED) \
@@ -235,6 +237,10 @@ static int test_lib(void)
 
     result = 1;
 end:
+    if (cryptolib != SD_INIT)
+        sd_close(cryptolib);
+    if (ssllib != SD_INIT)
+        sd_close(ssllib);
     return result;
 }
 #endif