From 0b7d0c2002061fc43f69bbc1e30bb50d7bf63c63 Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Tue, 21 Aug 2018 10:12:05 +0200 Subject: [PATCH] crypto/tls: Prevent usage of freed pointer found by coverity pass_freed_arg: Passing freed pointer "pemCert" as an argument to "WLog_PrintMessage". --- libfreerdp/crypto/tls.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libfreerdp/crypto/tls.c b/libfreerdp/crypto/tls.c index de889cf9a..5af8e4e72 100644 --- a/libfreerdp/crypto/tls.c +++ b/libfreerdp/crypto/tls.c @@ -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; }