From a9ab65a93568e89f24697c2398fafd7cfeecce65 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Thu, 1 Jun 2017 00:05:51 +0500 Subject: [PATCH] resolve an issue found by cppcheck: [libfreerdp/crypto/certificate.c:315] -> [libfreerdp/crypto/certificate.c:316]: (warning) Either the condition 'if(fingerprint&&fprint)' is redundant or there is possible null pointer dereference: fingerprint. --- libfreerdp/crypto/certificate.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libfreerdp/crypto/certificate.c b/libfreerdp/crypto/certificate.c index 782778055..4a6d5a7e0 100644 --- a/libfreerdp/crypto/certificate.c +++ b/libfreerdp/crypto/certificate.c @@ -312,9 +312,12 @@ static int certificate_data_match_raw(rdpCertificateStore* certificate_store, if (port == certificate_data->port) { found = TRUE; - match = (strcmp(certificate_data->fingerprint, fingerprint) == 0) ? 0 : -1; - if (fingerprint && fprint) - *fprint = _strdup(fingerprint); + if (fingerprint) + { + match = (strcmp(certificate_data->fingerprint, fingerprint) == 0) ? 0 : -1; + if (fprint) + *fprint = _strdup(fingerprint); + } if (subject && psubject) crypto_base64_decode(subject, strlen(subject), (BYTE**)psubject, &outLen); if (issuer && pissuer)