summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2022-12-23 02:26:16 +0000
committerjsing <>2022-12-23 02:26:16 +0000
commita4db83fe8af01b2a889a2ee9ead4e6e1e230b54e (patch)
treec1502abf0724af38378a71125d9bb57784e95670
parent7012788d276e90efef561660cf0b47292d5c400a (diff)
downloadopenbsd-a4db83fe8af01b2a889a2ee9ead4e6e1e230b54e.tar.gz
openbsd-a4db83fe8af01b2a889a2ee9ead4e6e1e230b54e.tar.bz2
openbsd-a4db83fe8af01b2a889a2ee9ead4e6e1e230b54e.zip
Make UI_destroy_method() NULL safe.
ok tb@
-rw-r--r--src/lib/libcrypto/ui/ui_lib.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c
index 69428f9a2a..e36c270a87 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.47 2022/12/23 02:22:58 jsing Exp $ */ 1/* $OpenBSD: ui_lib.c,v 1.48 2022/12/23 02:26:16 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 */
@@ -575,11 +575,13 @@ UI_create_method(const char *name)
575LCRYPTO_ALIAS(UI_create_method) 575LCRYPTO_ALIAS(UI_create_method)
576 576
577void 577void
578UI_destroy_method(UI_METHOD *ui_method) 578UI_destroy_method(UI_METHOD *method)
579{ 579{
580 free(ui_method->name); 580 if (method == NULL)
581 ui_method->name = NULL; 581 return;
582 free(ui_method); 582
583 free(method->name);
584 free(method);
583} 585}
584LCRYPTO_ALIAS(UI_destroy_method) 586LCRYPTO_ALIAS(UI_destroy_method)
585 587