close_console: Always unlock as the lock is always held

Fixes #17364

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17365)

(cherry picked from commit 5bea0e2ee9)
This commit is contained in:
Tomas Mraz 2021-12-28 13:32:57 +01:00
parent be44d58e80
commit b247bb52b8
1 changed files with 4 additions and 2 deletions

View File

@ -551,6 +551,8 @@ static int echo_console(UI *ui)
static int close_console(UI *ui) static int close_console(UI *ui)
{ {
int ret = 1;
if (tty_in != stdin) if (tty_in != stdin)
fclose(tty_in); fclose(tty_in);
if (tty_out != stderr) if (tty_out != stderr)
@ -560,12 +562,12 @@ static int close_console(UI *ui)
if (status != SS$_NORMAL) { if (status != SS$_NORMAL) {
ERR_raise_data(ERR_LIB_UI, UI_R_SYSDASSGN_ERROR, ERR_raise_data(ERR_LIB_UI, UI_R_SYSDASSGN_ERROR,
"status=%%X%08X", status); "status=%%X%08X", status);
return 0; ret = 0;
} }
# endif # endif
CRYPTO_THREAD_unlock(ui->lock); CRYPTO_THREAD_unlock(ui->lock);
return 1; return ret;
} }
# if !defined(OPENSSL_SYS_WINCE) # if !defined(OPENSSL_SYS_WINCE)