Moved the x509 XFREE to outside the FreeX509 function. Internally FreeX509 is only used in two places. One is for the ssl->peerCert, which is not dynamic anyways. The second is in the ExternalFreeX509 where it calls FreeX509 if its dynamic and will XFREE there.

This commit is contained in:
David Garske
2016-03-09 09:15:00 -08:00
parent daa1cd634e
commit f17dfa5b03
2 changed files with 1 additions and 2 deletions

View File

@@ -1695,8 +1695,6 @@ void FreeX509(WOLFSSL_X509* x509)
#endif /* OPENSSL_EXTRA */
if (x509->altNames)
FreeAltNames(x509->altNames, NULL);
if (x509->dynamicMemory)
XFREE(x509, NULL, DYNAMIC_TYPE_X509);
}

View File

@@ -9424,6 +9424,7 @@ static void ExternalFreeX509(WOLFSSL_X509* x509)
if (x509) {
if (x509->dynamicMemory) {
FreeX509(x509);
XFREE(x509, NULL, DYNAMIC_TYPE_X509);
} else {
WOLFSSL_MSG("free called on non dynamic object, not freeing");
}