crypt32: Avoid double free in CRYPT_LoadSIP on error path (coverity) (try 2)

Frédéric Delanoy frederic.delanoy at gmail.com
Mon Oct 29 15:17:31 CDT 2012


FreeLibrary(temp) can be called twice on error.

CID 714004

try 2: don't check for NULL before calling FreeLibrary
---
 dlls/crypt32/sip.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dlls/crypt32/sip.c b/dlls/crypt32/sip.c
index e43ebc7..4a32cad 100644
--- a/dlls/crypt32/sip.c
+++ b/dlls/crypt32/sip.c
@@ -634,14 +634,17 @@ static BOOL CRYPT_LoadSIP(const GUID *pgSubject)
     if (!sip.pfPut || temp != lib)
         goto error;
     FreeLibrary(temp);
+    temp = NULL;
     sip.pfCreate = CRYPT_LoadSIPFunc(pgSubject, szCreate, &temp);
     if (!sip.pfCreate || temp != lib)
         goto error;
     FreeLibrary(temp);
+    temp = NULL;
     sip.pfVerify = CRYPT_LoadSIPFunc(pgSubject, szVerify, &temp);
     if (!sip.pfVerify || temp != lib)
         goto error;
     FreeLibrary(temp);
+    temp = NULL;
     sip.pfRemove = CRYPT_LoadSIPFunc(pgSubject, szRemoveSigned, &temp);
     if (!sip.pfRemove || temp != lib)
         goto error;
-- 
1.8.0




More information about the wine-patches mailing list