From 9902ad884661178b3f5d08fc01069eb4c1b2ba95 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Fri, 23 Dec 2022 02:26:16 +0000 Subject: Make UI_destroy_method() NULL safe. ok tb@ --- src/lib/libcrypto/ui/ui_lib.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/lib') 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 @@ -/* $OpenBSD: ui_lib.c,v 1.47 2022/12/23 02:22:58 jsing Exp $ */ +/* $OpenBSD: ui_lib.c,v 1.48 2022/12/23 02:26:16 jsing Exp $ */ /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL * project 2001. */ @@ -575,11 +575,13 @@ UI_create_method(const char *name) LCRYPTO_ALIAS(UI_create_method) void -UI_destroy_method(UI_METHOD *ui_method) +UI_destroy_method(UI_METHOD *method) { - free(ui_method->name); - ui_method->name = NULL; - free(ui_method); + if (method == NULL) + return; + + free(method->name); + free(method); } LCRYPTO_ALIAS(UI_destroy_method) -- cgit v1.2.3-55-g6feb