crypto/tls: Prevent usage of freed pointer found by coverity
pass_freed_arg: Passing freed pointer "pemCert" as an argument to "WLog_PrintMessage".
@@ -1330,15 +1330,15 @@ int tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname,
{
accept_cert(tls, pemCert, length);
}
- else
- free(pemCert);
-
- if (status < 0)
+ else if (status < 0)
{
WLog_ERR(TAG, "VerifyX509Certificate failed: (length = %d) status: [%d] %s",
length, status, pemCert);
+ free(pemCert);
return -1;
}
+ else
+ free(pemCert);
return (status == 0) ? 0 : 1;
}
