Commit 218c382f authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

qedit/samplegrabber: Use calloc() in sample_grabber_create().

parent 9bcb1f51
...@@ -107,7 +107,7 @@ static void sample_grabber_destroy(struct strmbase_filter *iface) ...@@ -107,7 +107,7 @@ static void sample_grabber_destroy(struct strmbase_filter *iface)
strmbase_source_cleanup(&filter->source); strmbase_source_cleanup(&filter->source);
strmbase_passthrough_cleanup(&filter->passthrough); strmbase_passthrough_cleanup(&filter->passthrough);
strmbase_filter_cleanup(&filter->filter); strmbase_filter_cleanup(&filter->filter);
CoTaskMemFree(filter); free(filter);
} }
static HRESULT sample_grabber_query_interface(struct strmbase_filter *iface, REFIID iid, void **out) static HRESULT sample_grabber_query_interface(struct strmbase_filter *iface, REFIID iid, void **out)
...@@ -639,32 +639,27 @@ static const struct strmbase_source_ops source_ops = ...@@ -639,32 +639,27 @@ static const struct strmbase_source_ops source_ops =
HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out) HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out)
{ {
SG_Impl* obj = NULL; SG_Impl *object;
obj = CoTaskMemAlloc(sizeof(SG_Impl)); if (!(object = calloc(1, sizeof(*object))))
if (NULL == obj) {
*out = NULL;
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
ZeroMemory(obj, sizeof(SG_Impl));
strmbase_filter_init(&obj->filter, outer, &CLSID_SampleGrabber, &filter_ops); strmbase_filter_init(&object->filter, outer, &CLSID_SampleGrabber, &filter_ops);
obj->ISampleGrabber_iface.lpVtbl = &ISampleGrabber_VTable; object->ISampleGrabber_iface.lpVtbl = &ISampleGrabber_VTable;
obj->IMemInputPin_iface.lpVtbl = &IMemInputPin_VTable; object->IMemInputPin_iface.lpVtbl = &IMemInputPin_VTable;
strmbase_sink_init(&obj->sink, &obj->filter, L"In", &sink_ops, NULL); strmbase_sink_init(&object->sink, &object->filter, L"In", &sink_ops, NULL);
strmbase_source_init(&obj->source, &obj->filter, L"Out", &source_ops); strmbase_source_init(&object->source, &object->filter, L"Out", &source_ops);
strmbase_passthrough_init(&obj->passthrough, (IUnknown *)&obj->source.pin.IPin_iface); strmbase_passthrough_init(&object->passthrough, (IUnknown *)&object->source.pin.IPin_iface);
ISeekingPassThru_Init(&obj->passthrough.ISeekingPassThru_iface, FALSE, &obj->sink.pin.IPin_iface); ISeekingPassThru_Init(&object->passthrough.ISeekingPassThru_iface, FALSE,
&object->sink.pin.IPin_iface);
obj->allocator = NULL; object->grabberMethod = -1;
obj->grabberIface = NULL; object->oneShot = OneShot_None;
obj->grabberMethod = -1; object->bufferLen = -1;
obj->oneShot = OneShot_None;
obj->bufferLen = -1;
obj->bufferData = NULL;
*out = &obj->filter.IUnknown_inner; TRACE("Created sample grabber %p.\n", object);
*out = &object->filter.IUnknown_inner;
return S_OK; return S_OK;
} }
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