From a6e77c8721690972fa58c7a65d62e88b42c0ba8b Mon Sep 17 00:00:00 2001 From: mbuhl Date: Tue, 8 Nov 2022 23:19:09 +0000 Subject: [PATCH] In case lh_OBJ_NAME_insert returns NULL due to a failed malloc, onp is leaked in OBJ_NAME_add. ok tb Found by CodeChecker. --- lib/libcrypto/objects/o_names.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libcrypto/objects/o_names.c b/lib/libcrypto/objects/o_names.c index a9e5f859d57..2cdd2f3aa6d 100644 --- a/lib/libcrypto/objects/o_names.c +++ b/lib/libcrypto/objects/o_names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: o_names.c,v 1.22 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: o_names.c,v 1.23 2022/11/08 23:19:09 mbuhl Exp $ */ #include #include #include @@ -197,6 +197,7 @@ OBJ_NAME_add(const char *name, int type, const char *data) free(ret); } else { if (lh_OBJ_NAME_error(names_lh)) { + free(onp); /* ERROR */ return (0); } -- 2.20.1