From 51dbb44799f70f8e6abd33d8353677f8bb8f3e94 Mon Sep 17 00:00:00 2001 From: jordan Date: Fri, 3 Mar 2023 08:22:35 -0600 Subject: [PATCH] Fix ASN1_STRING leak in create_by_NID and create_by_txt --- src/x509.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/x509.c b/src/x509.c index 644299f9b..948ab6352 100644 --- a/src/x509.c +++ b/src/x509.c @@ -11125,6 +11125,11 @@ err: dataSz) == WOLFSSL_SUCCESS) { ne->set = 1; } + else { + /* Free the ASN1_STRING if it is not set. */ + wolfSSL_ASN1_STRING_free(ne->value); + ne->value = NULL; + } } } @@ -11174,6 +11179,11 @@ err: == WOLFSSL_SUCCESS) { ne->set = 1; } + else { + /* Free the ASN1_STRING if it is not set. */ + wolfSSL_ASN1_STRING_free(ne->value); + ne->value = NULL; + } } return ne;