[Bug 27178] advapi32: CryptEnumProvidersW may don't free resources

none7 menone7 at gmail.com
Sun May 15 13:41:22 CDT 2011


--- dlls/advapi32/crypt.c
+++ dlls/advapi32/crypt.c
@@ -1156,6 +1156,7 @@
 		if (!(provNameW = CRYPT_Alloc(*pcbProvName * sizeof(WCHAR))))
 		{
 			SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+			RegCloseKey(hKey);
 			return FALSE;
 		}

@@ -1167,6 +1168,7 @@
 		if (dwIndex >= numkeys)
 		{
 			SetLastError(ERROR_NO_MORE_ITEMS);
+			RegCloseKey(hKey);
 			return FALSE;
 		}
 	} else {
@@ -1178,12 +1180,20 @@
 		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))
+		{
+			RegCloseKey(subkey);
+			RegCloseKey(hKey);
 			return FALSE;
+		}
 		RegCloseKey(subkey);
 	}
 	RegCloseKey(hKey);



More information about the wine-patches mailing list