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;