Chris Robinson : quartz: Check allocation failure and clear memory in DSound Renderer.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Mar 9 15:47:48 CST 2007


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

Author: Chris Robinson <chris.kcat at gmail.com>
Date:   Fri Mar  9 05:47:37 2007 -0800

quartz: Check allocation failure and clear memory in DSound Renderer.

---

 dlls/quartz/dsoundrender.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c
index fe6152f..67ab550 100644
--- a/dlls/quartz/dsoundrender.c
+++ b/dlls/quartz/dsoundrender.c
@@ -316,18 +316,23 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv)
         return CLASS_E_NOAGGREGATION;
     
     pDSoundRender = CoTaskMemAlloc(sizeof(DSoundRenderImpl));
+    if (!pDSoundRender)
+        return E_OUTOFMEMORY;
+    ZeroMemory(pDSoundRender, sizeof(DSoundRenderImpl));
 
     pDSoundRender->lpVtbl = &DSoundRender_Vtbl;
     pDSoundRender->IBasicAudio_vtbl = &IBasicAudio_Vtbl;
     pDSoundRender->refCount = 1;
     InitializeCriticalSection(&pDSoundRender->csFilter);
     pDSoundRender->state = State_Stopped;
-    pDSoundRender->pClock = NULL;
-    pDSoundRender->init = FALSE;
-    pDSoundRender->started = FALSE;
-    ZeroMemory(&pDSoundRender->filterInfo, sizeof(FILTER_INFO));
 
     pDSoundRender->ppPins = CoTaskMemAlloc(1 * sizeof(IPin *));
+    if (!pDSoundRender->ppPins)
+    {
+        DeleteCriticalSection(&pDSoundRender->csFilter);
+        CoTaskMemFree(pDSoundRender);
+        return E_OUTOFMEMORY;
+    }
 
     /* construct input pin */
     piInput.dir = PINDIR_INPUT;




More information about the wine-cvs mailing list