diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2024-07-12 09:25:44 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2024-07-12 09:25:44 +0000 |
commit | 04b90705e196815303188f7af58a5adbe9fc48cb (patch) | |
tree | bd29cbafd7a0c5b42a159423db095747b7857ff3 /lib/libcrypto | |
parent | ec57250d1f75d020dcee15a0b4fdb011c79a3da1 (diff) |
Clean up X509_EXTENSION_create_by_NID()
Remove unnecessary ret parameter and freeing of obj (which looks like
a double free or freeing of unallocated memory but actually isn't due
to various magic flags). Also make this const correct.
ok jsing
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/x509/x509_v3.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/libcrypto/x509/x509_v3.c b/lib/libcrypto/x509/x509_v3.c index b0a30db2e8d..76e9777c259 100644 --- a/lib/libcrypto/x509/x509_v3.c +++ b/lib/libcrypto/x509/x509_v3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_v3.c,v 1.34 2024/07/12 08:58:59 tb Exp $ */ +/* $OpenBSD: x509_v3.c,v 1.35 2024/07/12 09:25:43 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -188,18 +188,14 @@ X509_EXTENSION * X509_EXTENSION_create_by_NID(X509_EXTENSION **ext, int nid, int crit, ASN1_OCTET_STRING *data) { - ASN1_OBJECT *obj; - X509_EXTENSION *ret; + const ASN1_OBJECT *obj; - obj = OBJ_nid2obj(nid); - if (obj == NULL) { + if ((obj = OBJ_nid2obj(nid)) == NULL) { X509error(X509_R_UNKNOWN_NID); return NULL; } - ret = X509_EXTENSION_create_by_OBJ(ext, obj, crit, data); - if (ret == NULL) - ASN1_OBJECT_free(obj); - return ret; + + return X509_EXTENSION_create_by_OBJ(ext, obj, crit, data); } LCRYPTO_ALIAS(X509_EXTENSION_create_by_NID); |