summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/ui/ui_lib.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c
index e36c270a87..8811bf86c7 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.48 2022/12/23 02:26:16 jsing Exp $ */ 1/* $OpenBSD: ui_lib.c,v 1.49 2022/12/23 02:27:47 jsing 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 */
@@ -561,16 +561,25 @@ UI_set_method(UI *ui, const UI_METHOD *meth)
561} 561}
562LCRYPTO_ALIAS(UI_set_method) 562LCRYPTO_ALIAS(UI_set_method)
563 563
564
565UI_METHOD * 564UI_METHOD *
566UI_create_method(const char *name) 565UI_create_method(const char *name)
567{ 566{
568 UI_METHOD *ui_method = calloc(1, sizeof(UI_METHOD)); 567 UI_METHOD *method = NULL;
568
569 if ((method = calloc(1, sizeof(UI_METHOD))) == NULL)
570 goto err;
569 571
570 if (ui_method && name) 572 if (name != NULL) {
571 ui_method->name = strdup(name); 573 if ((method->name = strdup(name)) == NULL)
574 goto err;
575 }
572 576
573 return ui_method; 577 return method;
578
579 err:
580 UI_destroy_method(method);
581
582 return NULL;
574} 583}
575LCRYPTO_ALIAS(UI_create_method) 584LCRYPTO_ALIAS(UI_create_method)
576 585