From b5a5100068cce00e77ad50be9ec95b1c0908581e Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Fri, 5 Jul 2019 14:33:35 -0600 Subject: [PATCH] move location of X509 free --- src/internal.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/internal.c b/src/internal.c index c597f9154..875dddf63 100644 --- a/src/internal.c +++ b/src/internal.c @@ -8555,10 +8555,6 @@ int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert) x509->pkCurveOID = dCert->pkCurveOID; #endif /* HAVE_ECC */ - if (ret != 0) { - wolfSSL_X509_free(x509); - } - return ret; } @@ -8862,6 +8858,9 @@ static int DoVerifyCallback(WOLFSSL* ssl, int ret, ProcPeerCertArgs* args) if (CopyDecodedToX509(x509, args->dCert) == 0) { store->current_cert = x509; } + else { + FreeX509(x509); + } } #endif #ifdef SESSION_CERTS