summaryrefslogtreecommitdiffstats
path: root/crypto/ui/ui_lib.c
diff options
context:
space:
mode:
authorAlessandro Ghedini <alessandro@ghedini.me>2016-02-29 17:12:25 +0000
committerRich Salz <rsalz@openssl.org>2016-03-08 11:10:34 -0500
commit41cfbccc99f3ca3c9f656d8c71e2db5bcfcf6817 (patch)
tree900c46e5cd1506da790f8f49404bcb518a96e1c8 /crypto/ui/ui_lib.c
parent9b398ef297dd1b74527dd0afee9f59cd3f5bc33d (diff)
Convert CRYPTO_LOCK_UI to new multi-threading API
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/ui/ui_lib.c')
-rw-r--r--crypto/ui/ui_lib.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/ui/ui_lib.c b/crypto/ui/ui_lib.c
index 08e6c7be37..7b08107f7a 100644
--- a/crypto/ui/ui_lib.c
+++ b/crypto/ui/ui_lib.c
@@ -79,6 +79,14 @@ UI *UI_new_method(const UI_METHOD *method)
UIerr(UI_F_UI_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return NULL;
}
+
+ ret->lock = CRYPTO_THREAD_lock_new();
+ if (ret->lock == NULL) {
+ UIerr(UI_F_UI_NEW_METHOD, ERR_R_MALLOC_FAILURE);
+ OPENSSL_free(ret);
+ return NULL;
+ }
+
if (method == NULL)
ret->meth = UI_get_default_method();
else
@@ -111,6 +119,7 @@ void UI_free(UI *ui)
return;
sk_UI_STRING_pop_free(ui->strings, free_string);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_UI, ui, &ui->ex_data);
+ CRYPTO_THREAD_lock_free(ui->lock);
OPENSSL_free(ui);
}