Andrew Nguyen : dxdiagn: Avoid zeroing memory in container functions.

Alexandre Julliard julliard at winehq.org
Tue Feb 1 12:24:58 CST 2011


Module: wine
Branch: master
Commit: 99e36ffabde8a5588c7ee9ae85abede4c7b33bd9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=99e36ffabde8a5588c7ee9ae85abede4c7b33bd9

Author: Andrew Nguyen <anguyen at codeweavers.com>
Date:   Tue Feb  1 04:31:47 2011 -0600

dxdiagn: Avoid zeroing memory in container functions.

---

 dlls/dxdiagn/container.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/dlls/dxdiagn/container.c b/dlls/dxdiagn/container.c
index 8585f7d..d3a3cc1 100644
--- a/dlls/dxdiagn/container.c
+++ b/dlls/dxdiagn/container.c
@@ -244,13 +244,17 @@ HRESULT WINAPI IDxDiagContainerImpl_AddProp(PDXDIAGCONTAINER iface, LPCWSTR pwsz
     return E_INVALIDARG;
   }
 
-  pNew =  HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDxDiagContainerImpl_Property));
+  pNew = HeapAlloc(GetProcessHeap(), 0, sizeof(IDxDiagContainerImpl_Property));
   if (NULL == pNew) {
     return E_OUTOFMEMORY;
   }
   VariantInit(&pNew->v);
   VariantCopy(&pNew->v, pVarProp);
-  pNew->vName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(pwszPropName) + 1) * sizeof(WCHAR));
+  pNew->vName = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(pwszPropName) + 1) * sizeof(WCHAR));
+  if (NULL == pNew->vName) {
+    HeapFree(GetProcessHeap(), 0, pNew);
+    return E_OUTOFMEMORY;
+  }
   lstrcpyW(pNew->vName, pwszPropName);
   pNew->next = NULL;
 
@@ -278,12 +282,16 @@ HRESULT WINAPI IDxDiagContainerImpl_AddChildContainer(PDXDIAGCONTAINER iface, LP
     return E_INVALIDARG;
   }
 
-  pNew =  HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDxDiagContainerImpl_SubContainer));
+  pNew = HeapAlloc(GetProcessHeap(), 0, sizeof(IDxDiagContainerImpl_SubContainer));
   if (NULL == pNew) {
     return E_OUTOFMEMORY;
   }
   pNew->pCont = pSubCont;
-  pNew->contName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(pszContName) + 1) * sizeof(WCHAR));
+  pNew->contName = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(pszContName) + 1) * sizeof(WCHAR));
+  if (NULL == pNew->contName) {
+    HeapFree(GetProcessHeap(), 0, pNew)
+    return E_OUTOFMEMORY;
+  }
   lstrcpyW(pNew->contName, pszContName);
   pNew->next = NULL;
 




More information about the wine-cvs mailing list