summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/ui/ui_lib.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c
index 1e3a4ee705..0a22eba69f 100644
--- a/src/lib/libcrypto/ui/ui_lib.c
+++ b/src/lib/libcrypto/ui/ui_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ui_lib.c,v 1.41 2020/09/25 10:56:36 tb Exp $ */ 1/* $OpenBSD: ui_lib.c,v 1.42 2020/09/25 11:05:21 tb Exp $ */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -79,20 +79,14 @@ UI_new_method(const UI_METHOD *method)
79{ 79{
80 UI *ret; 80 UI *ret;
81 81
82 ret = malloc(sizeof(UI)); 82 if ((ret = calloc(1, sizeof(UI))) == NULL) {
83 if (ret == NULL) {
84 UIerror(ERR_R_MALLOC_FAILURE); 83 UIerror(ERR_R_MALLOC_FAILURE);
85 return NULL; 84 return NULL;
86 } 85 }
87 if (method == NULL) 86 if ((ret->meth = method) == NULL)
88 ret->meth = UI_get_default_method(); 87 ret->meth = UI_get_default_method();
89 else
90 ret->meth = method;
91
92 ret->strings = NULL;
93 ret->user_data = NULL;
94 ret->flags = 0;
95 CRYPTO_new_ex_data(CRYPTO_EX_INDEX_UI, ret, &ret->ex_data); 88 CRYPTO_new_ex_data(CRYPTO_EX_INDEX_UI, ret, &ret->ex_data);
89
96 return ret; 90 return ret;
97} 91}
98 92