msi: automation: Installer::Products, verify HeapAlloc return value.

This commit is contained in:
Misha Koshelev 2007-05-14 12:15:58 -05:00 committed by Alexandre Julliard
parent 536b49905b
commit 5f2e81e2a5
1 changed files with 9 additions and 5 deletions

View File

@ -1386,12 +1386,16 @@ static HRESULT WINAPI InstallerImpl_Invoke(
/* Save product strings */
sldata = (StringListData *)private_data((AutomationObject *)pDispatch);
sldata->iCount = idx;
sldata->pszStrings = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LPWSTR)*sldata->iCount);
for (idx = 0; idx < sldata->iCount; idx++)
if (!(sldata->pszStrings = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LPWSTR)*sldata->iCount)))
ERR("Out of memory\n");
else
{
ret = MsiEnumProductsW(idx, szProductBuf);
sldata->pszStrings[idx] = SysAllocString(szProductBuf);
sldata->iCount = idx;
for (idx = 0; idx < sldata->iCount; idx++)
{
ret = MsiEnumProductsW(idx, szProductBuf);
sldata->pszStrings[idx] = SysAllocString(szProductBuf);
}
}
}
else