Index: dll/win32/advapi32/crypt/crypt.c =================================================================== --- dll/win32/advapi32/crypt/crypt.c (revision 53057) +++ dll/win32/advapi32/crypt/crypt.c (working copy) @@ -1108,6 +1108,7 @@ 'P','r','o','v','i','d','e','r',0 }; static const WCHAR typeW[] = {'T','y','p','e',0}; + BOOL ret; TRACE("(%d, %p, %d, %p, %p, %p)\n", dwIndex, pdwReserved, dwFlags, pdwProvType, pszProvName, pcbProvName); @@ -1129,6 +1130,7 @@ return FALSE; } + ret = TRUE; if (!pszProvName) { DWORD numkeys; @@ -1140,6 +1142,7 @@ if (!(provNameW = CRYPT_Alloc(*pcbProvName * sizeof(WCHAR)))) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); + RegCloseKey(hKey); return FALSE; } @@ -1151,7 +1154,7 @@ if (dwIndex >= numkeys) { SetLastError(ERROR_NO_MORE_ITEMS); - return FALSE; + ret = FALSE; } } else { DWORD size = sizeof(DWORD); @@ -1162,16 +1165,22 @@ if (result) { SetLastError(result); + RegCloseKey(hKey); return FALSE; } if (RegOpenKeyW(hKey, pszProvName, &subkey)) + { + RegCloseKey(hKey); return FALSE; + } + if (RegQueryValueExW(subkey, typeW, NULL, NULL, (BYTE*)pdwProvType, &size)) - return FALSE; + ret = FALSE; + RegCloseKey(subkey); } RegCloseKey(hKey); - return TRUE; + return ret; } /****************************************************************************** @@ -1184,7 +1193,7 @@ { PWSTR str = NULL; DWORD bufsize; - BOOL ret; /* = FALSE; */ + BOOL ret; TRACE("(%d, %p, %08x, %p, %p, %p)\n", dwIndex, pdwReserved, dwFlags, pdwProvType, pszProvName, pcbProvName); @@ -1271,19 +1280,24 @@ if (dwIndex >= numkeys) { SetLastError(ERROR_NO_MORE_ITEMS); + RegCloseKey(hKey); return FALSE; } keylen++; if ( !(keyname = CRYPT_Alloc(keylen*sizeof(WCHAR))) ) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); + RegCloseKey(hKey); return FALSE; } if ( RegEnumKeyW(hKey, dwIndex, keyname, keylen) ) { CRYPT_Free(keyname); + RegCloseKey(hKey); return FALSE; } RegOpenKeyW(hKey, keyname, &hSubkey); + RegCloseKey(hKey); + ch = keyname + strlenW(keyname); /* Convert "Type 000" to 0, etc/ */ *pdwProvType = *(--ch) - '0'; @@ -1295,11 +1309,11 @@ if (result) { SetLastError(result); + RegCloseKey(hSubkey); return FALSE; } RegCloseKey(hSubkey); - RegCloseKey(hKey); return TRUE; } @@ -1489,6 +1503,8 @@ CRYPT_Free(keyname); result = RegQueryValueExW(hKey, nameW, NULL, NULL, (LPBYTE)pszProvName, pcbProvName); + RegCloseKey(hKey); + if (result) { if (result != ERROR_MORE_DATA) @@ -1499,7 +1515,6 @@ return FALSE; } - RegCloseKey(hKey); return TRUE; } @@ -1513,7 +1528,7 @@ { PWSTR str = NULL; DWORD bufsize; - BOOL ret = FALSE; + BOOL ret; TRACE("(%d, %p, %08x, %p, %p)\n", dwProvType, pdwReserved, dwFlags, pszProvName, pcbProvName);