Commit 51bce1ec authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase: Use heap_alloc_zero() in enum_pins_create().

parent 2de9d9ec
...@@ -39,36 +39,35 @@ static inline IEnumPinsImpl *impl_from_IEnumPins(IEnumPins *iface) ...@@ -39,36 +39,35 @@ static inline IEnumPinsImpl *impl_from_IEnumPins(IEnumPins *iface)
static const struct IEnumPinsVtbl IEnumPinsImpl_Vtbl; static const struct IEnumPinsVtbl IEnumPinsImpl_Vtbl;
HRESULT enum_pins_create(BaseFilter *base, IEnumPins **ppEnum) HRESULT enum_pins_create(BaseFilter *base, IEnumPins **out)
{ {
IEnumPinsImpl * pEnumPins; IEnumPinsImpl *object;
IPin *pin; IPin *pin;
if (!ppEnum) if (!out)
return E_POINTER; return E_POINTER;
pEnumPins = CoTaskMemAlloc(sizeof(IEnumPinsImpl)); if (!(object = heap_alloc_zero(sizeof(*object))))
if (!pEnumPins)
{ {
*ppEnum = NULL; *out = NULL;
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
pEnumPins->IEnumPins_iface.lpVtbl = &IEnumPinsImpl_Vtbl;
pEnumPins->refCount = 1; object->IEnumPins_iface.lpVtbl = &IEnumPinsImpl_Vtbl;
pEnumPins->uIndex = 0; object->refCount = 1;
pEnumPins->base = base; object->base = base;
IBaseFilter_AddRef(&base->IBaseFilter_iface); IBaseFilter_AddRef(&base->IBaseFilter_iface);
*ppEnum = &pEnumPins->IEnumPins_iface; object->Version = base->pin_version;
pEnumPins->Version = base->pin_version;
pEnumPins->count = 0;
while ((pin = base->pFuncsTable->pfnGetPin(base, pEnumPins->count))) while ((pin = base->pFuncsTable->pfnGetPin(base, object->count)))
{ {
IPin_Release(pin); IPin_Release(pin);
++pEnumPins->count; ++object->count;
} }
TRACE("Created new enumerator (%p)\n", *ppEnum); TRACE("Created enumerator %p.\n", object);
*out = &object->IEnumPins_iface;
return S_OK; return S_OK;
} }
...@@ -114,7 +113,7 @@ static ULONG WINAPI IEnumPinsImpl_Release(IEnumPins * iface) ...@@ -114,7 +113,7 @@ static ULONG WINAPI IEnumPinsImpl_Release(IEnumPins * iface)
if (!ref) if (!ref)
{ {
IBaseFilter_Release(&This->base->IBaseFilter_iface); IBaseFilter_Release(&This->base->IBaseFilter_iface);
CoTaskMemFree(This); heap_free(This);
} }
return ref; return ref;
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "dshow.h" #include "dshow.h"
#include "uuids.h" #include "uuids.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/strmbase.h" #include "wine/strmbase.h"
#include "wine/unicode.h" #include "wine/unicode.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment