From: Tomas Mraz Date: Tue, 28 Dec 2021 12:32:57 +0000 (+0100) Subject: close_console: Always unlock as the lock is always held X-Git-Tag: OpenSSL_1_1_1n~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52d9a1d0448432182a5fab0753c236b29819a2a5;p=thirdparty%2Fopenssl.git close_console: Always unlock as the lock is always held Fixes #17364 Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17395) --- diff --git a/crypto/ui/ui_openssl.c b/crypto/ui/ui_openssl.c index 9526c16536c..eab29e288d0 100644 --- a/crypto/ui/ui_openssl.c +++ b/crypto/ui/ui_openssl.c @@ -572,6 +572,8 @@ static int echo_console(UI *ui) static int close_console(UI *ui) { + int ret = 1; + if (tty_in != stdin) fclose(tty_in); if (tty_out != stderr) @@ -584,12 +586,12 @@ static int close_console(UI *ui) BIO_snprintf(tmp_num, sizeof(tmp_num) - 1, "%%X%08X", status); UIerr(UI_F_CLOSE_CONSOLE, UI_R_SYSDASSGN_ERROR); ERR_add_error_data(2, "status=", tmp_num); - return 0; + ret = 0; } # endif CRYPTO_THREAD_unlock(ui->lock); - return 1; + return ret; } # if !defined(OPENSSL_SYS_WINCE)