No need to allocate too much memory, as SetupDiGetDeviceRegistryPropertyW returns a size in bytes, not in characters. Bug spotted by Filip

svn path=/trunk/; revision=17605
This commit is contained in:
Hervé Poussineau 2005-09-02 18:51:32 +00:00
parent 02488d3f49
commit c1f3b3a122

View file

@ -3466,7 +3466,7 @@ SetupDiBuildDriverInfoList(
while (!Result && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
HeapFree(GetProcessHeap(), 0, HardwareIDs);
HardwareIDs = HeapAlloc(GetProcessHeap(), 0, RequiredSize * sizeof(WCHAR));
HardwareIDs = HeapAlloc(GetProcessHeap(), 0, RequiredSize);
if (!HardwareIDs)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@ -3491,7 +3491,7 @@ SetupDiBuildDriverInfoList(
while (!Result && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
HeapFree(GetProcessHeap(), 0, CompatibleIDs);
CompatibleIDs = HeapAlloc(GetProcessHeap(), 0, RequiredSize * sizeof(WCHAR));
CompatibleIDs = HeapAlloc(GetProcessHeap(), 0, RequiredSize);
if (!CompatibleIDs)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);