Module: wine Branch: master Commit: 5f2e81e2a51674f1e5cc42c4743c81c366685188 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5f2e81e2a51674f1e5cc42c474...
Author: Misha Koshelev mk144210@bcm.edu Date: Mon May 14 12:15:58 2007 -0500
msi: automation: Installer::Products, verify HeapAlloc return value.
---
dlls/msi/automation.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/msi/automation.c b/dlls/msi/automation.c index 4cd7ba9..c6088de 100644 --- a/dlls/msi/automation.c +++ b/dlls/msi/automation.c @@ -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