From: Pauli Date: Thu, 18 Mar 2021 00:45:35 +0000 (+1000) Subject: test: fix coverity 1414449 & 1414471: resource leak X-Git-Tag: openssl-3.0.0-alpha14~192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65bf029d498e237c0c5b3f098b7fe932f2958e84;p=thirdparty%2Fopenssl.git test: fix coverity 1414449 & 1414471: resource leak Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14596) --- diff --git a/test/shlibloadtest.c b/test/shlibloadtest.c index c879e9a01e6..8d3c87d36cf 100644 --- a/test/shlibloadtest.c +++ b/test/shlibloadtest.c @@ -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