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.