quartz: Check allocation failure and clear memory in DSound Renderer

Robert Shearman rob at codeweavers.com
Fri Mar 9 05:26:31 CST 2007


Chris Robinson wrote:
>          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;
> @@ -325,9 +328,15 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv)
>      pDSoundRender->pClock = NULL;
>      pDSoundRender->init = FALSE;
>      pDSoundRender->started = FALSE;
> -    ZeroMemory(&pDSoundRender->filterInfo, sizeof(FILTER_INFO));
>   

The check for allocation failure is good, but clearing the memory that 
is going to be initialised anyway is inefficient and unnecessary.

-- 
Rob Shearman




More information about the wine-devel mailing list