summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authormbuhl <>2022-11-08 23:19:09 +0000
committermbuhl <>2022-11-08 23:19:09 +0000
commitcb807f8b7e4cd28229e0cbdc51998a66b0e45e3d (patch)
treeed4a549318f2c8bfc8264bfdff8356dd52800a12 /src/lib
parentc5e5c8535eaf416cc6e8ec82dd1c254315b02397 (diff)
downloadopenbsd-cb807f8b7e4cd28229e0cbdc51998a66b0e45e3d.tar.gz
openbsd-cb807f8b7e4cd28229e0cbdc51998a66b0e45e3d.tar.bz2
openbsd-cb807f8b7e4cd28229e0cbdc51998a66b0e45e3d.zip
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.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/objects/o_names.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/libcrypto/objects/o_names.c b/src/lib/libcrypto/objects/o_names.c
index a9e5f859d5..2cdd2f3aa6 100644
--- a/src/lib/libcrypto/objects/o_names.c
+++ b/src/lib/libcrypto/objects/o_names.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: o_names.c,v 1.22 2017/01/29 17:49:23 beck Exp $ */ 1/* $OpenBSD: o_names.c,v 1.23 2022/11/08 23:19:09 mbuhl Exp $ */
2#include <stdio.h> 2#include <stdio.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#include <string.h> 4#include <string.h>
@@ -197,6 +197,7 @@ OBJ_NAME_add(const char *name, int type, const char *data)
197 free(ret); 197 free(ret);
198 } else { 198 } else {
199 if (lh_OBJ_NAME_error(names_lh)) { 199 if (lh_OBJ_NAME_error(names_lh)) {
200 free(onp);
200 /* ERROR */ 201 /* ERROR */
201 return (0); 202 return (0);
202 } 203 }