]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
close_console: Always unlock as the lock is always held
authorTomas Mraz <tomas@openssl.org>
Tue, 28 Dec 2021 12:32:57 +0000 (13:32 +0100)
committerTomas Mraz <tomas@openssl.org>
Wed, 5 Jan 2022 09:04:51 +0000 (10:04 +0100)
Fixes #17364

Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17395)

crypto/ui/ui_openssl.c

index 9526c16536cbefb2dd6089d88f82b3a47c2d70ae..eab29e288d02cb915cc72a6c3d903df85579f628 100644 (file)
@@ -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)