From 7dd75d1181ba5038d9f3b0f40e669b7541435315 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Mon, 2 Nov 2009 10:27:25 -0800 Subject: [PATCH] crypt32: Fix a memory leak querying a message object. --- dlls/crypt32/object.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/crypt32/object.c b/dlls/crypt32/object.c index c3377844ad3..3d18c505fb4 100644 --- a/dlls/crypt32/object.c +++ b/dlls/crypt32/object.c @@ -599,11 +599,13 @@ static BOOL CRYPT_QueryMessageObject(DWORD dwObjectType, const void *pvObject, { if (pdwFormatType) *pdwFormatType = formatType; - if (phMsg) - *phMsg = msg; if (phCertStore) *phCertStore = CertOpenStore(CERT_STORE_PROV_MSG, encodingType, 0, 0, msg); + if (phMsg) + *phMsg = msg; + else + CryptMsgClose(msg); } if (blob == &fileBlob) CryptMemFree(blob->pbData);