mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 11:53:38 +00:00
qcap: Use malloc() instead of HeapAlloc() or CoTaskMemAlloc().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8f8cdc7ac7
commit
b0b63aec47
|
@ -47,7 +47,7 @@ static void audio_record_destroy(struct strmbase_filter *iface)
|
|||
AudioRecord *filter = impl_from_strmbase_filter(iface);
|
||||
|
||||
strmbase_filter_cleanup(&filter->filter);
|
||||
CoTaskMemFree(filter);
|
||||
free(filter);
|
||||
}
|
||||
|
||||
static HRESULT audio_record_query_interface(struct strmbase_filter *iface, REFIID iid, void **out)
|
||||
|
@ -144,9 +144,8 @@ HRESULT audio_record_create(IUnknown *outer, IUnknown **out)
|
|||
{
|
||||
AudioRecord *object;
|
||||
|
||||
if (!(object = CoTaskMemAlloc(sizeof(*object))))
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
memset(object, 0, sizeof(*object));
|
||||
|
||||
object->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl;
|
||||
strmbase_filter_init(&object->filter, outer, &CLSID_AudioRecord, &filter_ops);
|
||||
|
|
|
@ -85,13 +85,11 @@ static HRESULT fill_format_info(AVICompressor *This, VIDEOINFOHEADER *src_videoi
|
|||
}
|
||||
|
||||
size += FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
|
||||
This->videoinfo = heap_alloc(size);
|
||||
if(!This->videoinfo)
|
||||
if (!(This->videoinfo = calloc(1, size)))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
This->videoinfo_size = size;
|
||||
This->driver_flags = icinfo.dwFlags;
|
||||
memset(This->videoinfo, 0, sizeof(*This->videoinfo));
|
||||
ICCompressGetFormat(This->hic, &src_videoinfo->bmiHeader, &This->videoinfo->bmiHeader);
|
||||
|
||||
This->videoinfo->dwBitRate = 10000000/src_videoinfo->AvgTimePerFrame * This->videoinfo->bmiHeader.biSizeImage * 8;
|
||||
|
@ -117,11 +115,11 @@ static void avi_compressor_destroy(struct strmbase_filter *iface)
|
|||
|
||||
if (filter->hic)
|
||||
ICClose(filter->hic);
|
||||
heap_free(filter->videoinfo);
|
||||
free(filter->videoinfo);
|
||||
strmbase_sink_cleanup(&filter->sink);
|
||||
strmbase_source_cleanup(&filter->source);
|
||||
strmbase_filter_cleanup(&filter->filter);
|
||||
heap_free(filter);
|
||||
free(filter);
|
||||
}
|
||||
|
||||
static HRESULT avi_compressor_query_interface(struct strmbase_filter *iface, REFIID iid, void **out)
|
||||
|
@ -401,7 +399,7 @@ static HRESULT sink_connect(struct strmbase_sink *iface, IPin *peer, const AM_ME
|
|||
static void sink_disconnect(struct strmbase_sink *iface)
|
||||
{
|
||||
AVICompressor *filter = impl_from_strmbase_pin(&iface->pin);
|
||||
heap_free(filter->videoinfo);
|
||||
free(filter->videoinfo);
|
||||
filter->videoinfo = NULL;
|
||||
}
|
||||
|
||||
|
@ -470,7 +468,7 @@ HRESULT avi_compressor_create(IUnknown *outer, IUnknown **out)
|
|||
{
|
||||
AVICompressor *object;
|
||||
|
||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
strmbase_filter_init(&object->filter, outer, &CLSID_AVICo, &filter_ops);
|
||||
|
|
|
@ -125,12 +125,12 @@ static void avi_mux_destroy(struct strmbase_filter *iface)
|
|||
IMemAllocator_Release(filter->in[i]->samples_allocator);
|
||||
filter->in[i]->samples_allocator = NULL;
|
||||
strmbase_sink_cleanup(&filter->in[i]->pin);
|
||||
heap_free(filter->in[i]);
|
||||
free(filter->in[i]);
|
||||
}
|
||||
|
||||
heap_free(filter->idx1);
|
||||
free(filter->idx1);
|
||||
strmbase_filter_cleanup(&filter->filter);
|
||||
heap_free(filter);
|
||||
free(filter);
|
||||
ObjectRefCount(FALSE);
|
||||
}
|
||||
|
||||
|
@ -225,8 +225,7 @@ static HRESULT out_write(AviMux *This, const void *data, int size)
|
|||
static inline HRESULT idx1_add_entry(AviMux *avimux, DWORD ckid, DWORD flags, DWORD off, DWORD len)
|
||||
{
|
||||
if(avimux->idx1_entries == avimux->idx1_size) {
|
||||
AVIINDEXENTRY *new_idx = HeapReAlloc(GetProcessHeap(), 0, avimux->idx1,
|
||||
sizeof(*avimux->idx1)*2*avimux->idx1_size);
|
||||
AVIINDEXENTRY *new_idx = realloc(avimux->idx1, sizeof(*avimux->idx1) * 2 * avimux->idx1_size);
|
||||
if(!new_idx)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -576,8 +575,7 @@ static HRESULT avi_mux_init_stream(struct strmbase_filter *iface)
|
|||
This->idx1_entries = 0;
|
||||
if(!This->idx1_size) {
|
||||
This->idx1_size = 1024;
|
||||
This->idx1 = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->idx1)*This->idx1_size);
|
||||
if(!This->idx1)
|
||||
if (!(This->idx1 = malloc(sizeof(*This->idx1) * This->idx1_size)))
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
|
@ -1433,7 +1431,7 @@ static HRESULT avi_mux_sink_connect(struct strmbase_sink *iface, IPin *peer, con
|
|||
return hr;
|
||||
|
||||
size = pmt->cbFormat - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
|
||||
avimuxin->strf = CoTaskMemAlloc(sizeof(RIFFCHUNK) + ALIGN(FIELD_OFFSET(BITMAPINFO, bmiColors[vih->bmiHeader.biClrUsed])));
|
||||
avimuxin->strf = malloc(sizeof(RIFFCHUNK) + ALIGN(FIELD_OFFSET(BITMAPINFO, bmiColors[vih->bmiHeader.biClrUsed])));
|
||||
avimuxin->strf->fcc = ckidSTREAMFORMAT;
|
||||
avimuxin->strf->cb = FIELD_OFFSET(BITMAPINFO, bmiColors[vih->bmiHeader.biClrUsed]);
|
||||
if(size > avimuxin->strf->cb)
|
||||
|
@ -1467,7 +1465,7 @@ static void avi_mux_sink_disconnect(struct strmbase_sink *iface)
|
|||
if(cur == avimuxin->samples_head)
|
||||
avimuxin->samples_head = NULL;
|
||||
}
|
||||
CoTaskMemFree(avimuxin->strf);
|
||||
free(avimuxin->strf);
|
||||
avimuxin->strf = NULL;
|
||||
}
|
||||
|
||||
|
@ -1786,7 +1784,7 @@ static HRESULT create_input_pin(AviMux *avimux)
|
|||
|
||||
swprintf(name, ARRAY_SIZE(name), L"Input %02u", avimux->input_pin_no + 1);
|
||||
|
||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
strmbase_sink_init(&object->pin, &avimux->filter, name, &sink_ops, NULL);
|
||||
|
@ -1800,7 +1798,7 @@ static HRESULT create_input_pin(AviMux *avimux)
|
|||
if (FAILED(hr))
|
||||
{
|
||||
strmbase_sink_cleanup(&object->pin);
|
||||
heap_free(object);
|
||||
free(object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -1810,7 +1808,7 @@ static HRESULT create_input_pin(AviMux *avimux)
|
|||
{
|
||||
IMemAllocator_Release(object->samples_allocator);
|
||||
strmbase_sink_cleanup(&object->pin);
|
||||
heap_free(object);
|
||||
free(object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -1826,7 +1824,7 @@ HRESULT avi_mux_create(IUnknown *outer, IUnknown **out)
|
|||
AviMux *avimux;
|
||||
HRESULT hr;
|
||||
|
||||
if (!(avimux = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AviMux))))
|
||||
if (!(avimux = calloc(1, sizeof(AviMux))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
strmbase_filter_init(&avimux->filter, outer, &CLSID_AviDest, &filter_ops);
|
||||
|
@ -1846,7 +1844,7 @@ HRESULT avi_mux_create(IUnknown *outer, IUnknown **out)
|
|||
if(FAILED(hr)) {
|
||||
strmbase_source_cleanup(&avimux->source);
|
||||
strmbase_filter_cleanup(&avimux->filter);
|
||||
HeapFree(GetProcessHeap(), 0, avimux);
|
||||
free(avimux);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ HRESULT capture_graph_create(IUnknown *outer, IUnknown **out)
|
|||
if (outer)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
if (!(object = CoTaskMemAlloc(sizeof(*object))))
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
object->ICaptureGraphBuilder2_iface.lpVtbl = &builder2_Vtbl;
|
||||
|
@ -122,7 +122,7 @@ static ULONG WINAPI fnCaptureGraphBuilder2_Release(ICaptureGraphBuilder2 * iface
|
|||
DeleteCriticalSection(&This->csFilter);
|
||||
if (This->mygraph)
|
||||
IGraphBuilder_Release(This->mygraph);
|
||||
CoTaskMemFree(This);
|
||||
free(This);
|
||||
ObjectRefCount(FALSE);
|
||||
}
|
||||
return ref;
|
||||
|
|
|
@ -161,10 +161,10 @@ static void file_writer_destroy(struct strmbase_filter *iface)
|
|||
{
|
||||
struct file_writer *filter = impl_from_strmbase_filter(iface);
|
||||
|
||||
heap_free(filter->filename);
|
||||
free(filter->filename);
|
||||
strmbase_sink_cleanup(&filter->sink);
|
||||
strmbase_filter_cleanup(&filter->filter);
|
||||
heap_free(filter);
|
||||
free(filter);
|
||||
}
|
||||
|
||||
static HRESULT file_writer_init_stream(struct strmbase_filter *iface)
|
||||
|
@ -245,11 +245,10 @@ static HRESULT WINAPI filesinkfilter_SetFileName(IFileSinkFilter *iface,
|
|||
if (mt)
|
||||
FIXME("Ignoring media type %p.\n", mt);
|
||||
|
||||
if (!(new_filename = heap_alloc((wcslen(filename) + 1) * sizeof(WCHAR))))
|
||||
if (!(new_filename = wcsdup(filename)))
|
||||
return E_OUTOFMEMORY;
|
||||
wcscpy(new_filename, filename);
|
||||
|
||||
heap_free(filter->filename);
|
||||
free(filter->filename);
|
||||
filter->filename = new_filename;
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -317,7 +316,7 @@ HRESULT file_writer_create(IUnknown *outer, IUnknown **out)
|
|||
{
|
||||
struct file_writer *object;
|
||||
|
||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
strmbase_filter_init(&object->filter, outer, &CLSID_FileWriter, &filter_ops);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#define NONAMELESSUNION
|
||||
#include "dshow.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
#include "wine/strmbase.h"
|
||||
|
||||
extern HINSTANCE qcap_instance DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -59,7 +59,7 @@ static void smart_tee_destroy(struct strmbase_filter *iface)
|
|||
strmbase_source_cleanup(&filter->capture);
|
||||
strmbase_source_cleanup(&filter->preview);
|
||||
strmbase_filter_cleanup(&filter->filter);
|
||||
CoTaskMemFree(filter);
|
||||
free(filter);
|
||||
}
|
||||
|
||||
static HRESULT smart_tee_wait_state(struct strmbase_filter *iface, DWORD timeout)
|
||||
|
@ -319,9 +319,8 @@ HRESULT smart_tee_create(IUnknown *outer, IUnknown **out)
|
|||
SmartTeeFilter *object;
|
||||
HRESULT hr;
|
||||
|
||||
if (!(object = CoTaskMemAlloc(sizeof(*object))))
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
memset(object, 0, sizeof(*object));
|
||||
|
||||
strmbase_filter_init(&object->filter, outer, &CLSID_SmartTee, &filter_ops);
|
||||
strmbase_sink_init(&object->sink, &object->filter, L"Input", &sink_ops, NULL);
|
||||
|
@ -330,7 +329,7 @@ HRESULT smart_tee_create(IUnknown *outer, IUnknown **out)
|
|||
if (FAILED(hr))
|
||||
{
|
||||
strmbase_filter_cleanup(&object->filter);
|
||||
CoTaskMemFree(object);
|
||||
free(object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ static void vfw_capture_destroy(struct strmbase_filter *iface)
|
|||
DeleteCriticalSection(&filter->state_cs);
|
||||
strmbase_source_cleanup(&filter->source);
|
||||
strmbase_filter_cleanup(&filter->filter);
|
||||
CoTaskMemFree(filter);
|
||||
free(filter);
|
||||
ObjectRefCount(FALSE);
|
||||
}
|
||||
|
||||
|
@ -852,7 +852,7 @@ HRESULT vfw_capture_create(IUnknown *outer, IUnknown **out)
|
|||
if (!InitOnceExecuteOnce(&init_once, load_capture_funcs, NULL, NULL) || !capture_funcs)
|
||||
return E_FAIL;
|
||||
|
||||
if (!(object = CoTaskMemAlloc(sizeof(*object))))
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
strmbase_filter_init(&object->filter, outer, &CLSID_VfwCapture, &filter_ops);
|
||||
|
@ -862,7 +862,6 @@ HRESULT vfw_capture_create(IUnknown *outer, IUnknown **out)
|
|||
object->IAMVideoProcAmp_iface.lpVtbl = &IAMVideoProcAmp_VTable;
|
||||
object->IAMFilterMiscFlags_iface.lpVtbl = &IAMFilterMiscFlags_VTable;
|
||||
object->IPersistPropertyBag_iface.lpVtbl = &IPersistPropertyBag_VTable;
|
||||
object->init = FALSE;
|
||||
|
||||
strmbase_source_init(&object->source, &object->filter, L"Output", &source_ops);
|
||||
|
||||
|
|
Loading…
Reference in a new issue