move location of X509 free

This commit is contained in:
Jacob Barthelmeh
2019-07-05 14:33:35 -06:00
parent 5dcd421580
commit b5a5100068

View File

@@ -8555,10 +8555,6 @@ int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert)
x509->pkCurveOID = dCert->pkCurveOID; x509->pkCurveOID = dCert->pkCurveOID;
#endif /* HAVE_ECC */ #endif /* HAVE_ECC */
if (ret != 0) {
wolfSSL_X509_free(x509);
}
return ret; return ret;
} }
@@ -8862,6 +8858,9 @@ static int DoVerifyCallback(WOLFSSL* ssl, int ret, ProcPeerCertArgs* args)
if (CopyDecodedToX509(x509, args->dCert) == 0) { if (CopyDecodedToX509(x509, args->dCert) == 0) {
store->current_cert = x509; store->current_cert = x509;
} }
else {
FreeX509(x509);
}
} }
#endif #endif
#ifdef SESSION_CERTS #ifdef SESSION_CERTS