No need to allocate too much memory, as SetupDiGetDeviceRegistryPropertyW returns...
authorHervé Poussineau <hpoussin@reactos.org>
Fri, 2 Sep 2005 18:51:32 +0000 (18:51 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Fri, 2 Sep 2005 18:51:32 +0000 (18:51 +0000)
svn path=/trunk/; revision=17605

reactos/lib/setupapi/devinst.c

index 2052845..b88d805 100644 (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);