From 7aa7788af041a1a5366eaf263b1356f7f9f79e33 Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 8 Mar 2017 02:57:11 +0100 Subject: [PATCH] Add clean up for isCertificateValidated() function --- PowerEditor/src/MISC/Common/Common.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index f2b39b8d..8f6a483e 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -1079,6 +1079,13 @@ bool isCertificateValidated(const generic_string & fullFilePath, const generic_s { throw generic_string(TEXT("Certificate checking error: the certificate is not matched.")); } + + // Clean up. + if (pSignerInfo != NULL) LocalFree(pSignerInfo); + if (pCertContext != NULL) CertFreeCertificateContext(pCertContext); + if (hStore != NULL) CertCloseStore(hStore, 0); + if (hMsg != NULL) CryptMsgClose(hMsg); + if (szName != NULL) LocalFree(szName); } catch (generic_string s) {