From: Pauli Date: Thu, 18 Mar 2021 02:54:28 +0000 (+1000) Subject: test: fix coverity 1470559: resource leak X-Git-Tag: openssl-3.0.0-alpha14~189 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b0f76e12f8de88c8709fe53e85f887485ef53f4;p=thirdparty%2Fopenssl.git test: fix coverity 1470559: resource leak Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14596) --- diff --git a/test/moduleloadtest.c b/test/moduleloadtest.c index 915343f055d..2ad0dac7524 100644 --- a/test/moduleloadtest.c +++ b/test/moduleloadtest.c @@ -23,10 +23,14 @@ static int test_load(const char *path, const char *symbol) #ifdef SD_INIT SD sd = SD_INIT; SD_SYM sym; - - return sd_load(path, &sd, SD_MODULE) - && (symbol == NULL || sd_sym(sd, symbol, &sym)) - && sd_close(sd); + int ret; + + if (!sd_load(path, &sd, SD_MODULE)) + return 0; + ret = symbol == NULL || sd_sym(sd, symbol, &sym); + if (!sd_close(sd)) + ret = 0; + return ret; #else fprintf(stderr, "No dynamic loader\n"); return 0;