From b87c2fc6213e7242540ac32fb2cd25a64949fbe3 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Tue, 18 Apr 2023 14:29:13 -0500 Subject: [PATCH] fix null pointer deref (found by cppcheck:nullPointerRedundantCheck) in src/x509.c:wolfSSL_X509_EXTENSION_create_by_OBJ(). --- src/x509.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/x509.c b/src/x509.c index c8fcebfb2..ca5ffd5a4 100644 --- a/src/x509.c +++ b/src/x509.c @@ -307,7 +307,9 @@ WOLFSSL_X509_EXTENSION* wolfSSL_X509_EXTENSION_create_by_OBJ( wolfSSL_ASN1_STRING_free(&ret->value); } - ret->crit = crit; + if (err == 0) { + ret->crit = crit; + } if (err == 0) { ret->obj = wolfSSL_ASN1_OBJECT_dup(obj);