diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 86f723b05..44e9177e0 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -16198,8 +16198,8 @@ static int DecodeNameConstraints(const byte* input, int sz, DecodedCert* cert) if (ret == 0) { /* Parse NameConstraints. */ - ret = GetASN_Items(nameConstraintsASN, dataASN, nameConstraintsASN_Length, - 1, input, &idx, sz); + ret = GetASN_Items(nameConstraintsASN, dataASN, + nameConstraintsASN_Length, 1, input, &idx, sz); } if (ret == 0) { /* If there was a permittedSubtrees then parse it. */ @@ -16220,6 +16220,8 @@ static int DecodeNameConstraints(const byte* input, int sz, DecodedCert* cert) } } + FREE_ASNGETDATA(dataASN, cert->heap); + return ret; #endif /* WOLFSSL_ASN_TEMPLATE */ }