Commit bab4f293 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf: Use CRT allocation functions.

parent 569f1ac0
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#define COBJMACROS #define COBJMACROS
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
#include "mf_private.h" #include "mf_private.h"
...@@ -174,7 +173,7 @@ static ULONG WINAPI sink_notification_Release(IUnknown *iface) ...@@ -174,7 +173,7 @@ static ULONG WINAPI sink_notification_Release(IUnknown *iface)
if (!refcount) if (!refcount)
{ {
IMFClockStateSink_Release(notification->sink); IMFClockStateSink_Release(notification->sink);
heap_free(notification); free(notification);
} }
return refcount; return refcount;
...@@ -194,8 +193,7 @@ static void clock_notify_async_sink(struct presentation_clock *clock, MFTIME sys ...@@ -194,8 +193,7 @@ static void clock_notify_async_sink(struct presentation_clock *clock, MFTIME sys
IMFAsyncResult *result; IMFAsyncResult *result;
HRESULT hr; HRESULT hr;
object = heap_alloc(sizeof(*object)); if (!(object = malloc(sizeof(*object))))
if (!object)
return; return;
object->IUnknown_iface.lpVtbl = &sinknotificationvtbl; object->IUnknown_iface.lpVtbl = &sinknotificationvtbl;
...@@ -279,7 +277,7 @@ static ULONG WINAPI present_clock_Release(IMFPresentationClock *iface) ...@@ -279,7 +277,7 @@ static ULONG WINAPI present_clock_Release(IMFPresentationClock *iface)
{ {
list_remove(&sink->entry); list_remove(&sink->entry);
IMFClockStateSink_Release(sink->state_sink); IMFClockStateSink_Release(sink->state_sink);
heap_free(sink); free(sink);
} }
LIST_FOR_EACH_ENTRY_SAFE(timer, timer2, &clock->timers, struct clock_timer, entry) LIST_FOR_EACH_ENTRY_SAFE(timer, timer2, &clock->timers, struct clock_timer, entry)
{ {
...@@ -287,7 +285,7 @@ static ULONG WINAPI present_clock_Release(IMFPresentationClock *iface) ...@@ -287,7 +285,7 @@ static ULONG WINAPI present_clock_Release(IMFPresentationClock *iface)
IUnknown_Release(&timer->IUnknown_iface); IUnknown_Release(&timer->IUnknown_iface);
} }
DeleteCriticalSection(&clock->cs); DeleteCriticalSection(&clock->cs);
heap_free(clock); free(clock);
} }
return refcount; return refcount;
...@@ -456,8 +454,7 @@ static HRESULT WINAPI present_clock_AddClockStateSink(IMFPresentationClock *ifac ...@@ -456,8 +454,7 @@ static HRESULT WINAPI present_clock_AddClockStateSink(IMFPresentationClock *ifac
if (!state_sink) if (!state_sink)
return E_INVALIDARG; return E_INVALIDARG;
sink = heap_alloc(sizeof(*sink)); if (!(sink = malloc(sizeof(*sink))))
if (!sink)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
sink->state_sink = state_sink; sink->state_sink = state_sink;
...@@ -496,7 +493,7 @@ static HRESULT WINAPI present_clock_AddClockStateSink(IMFPresentationClock *ifac ...@@ -496,7 +493,7 @@ static HRESULT WINAPI present_clock_AddClockStateSink(IMFPresentationClock *ifac
if (FAILED(hr)) if (FAILED(hr))
{ {
IMFClockStateSink_Release(sink->state_sink); IMFClockStateSink_Release(sink->state_sink);
heap_free(sink); free(sink);
} }
return hr; return hr;
...@@ -520,7 +517,7 @@ static HRESULT WINAPI present_clock_RemoveClockStateSink(IMFPresentationClock *i ...@@ -520,7 +517,7 @@ static HRESULT WINAPI present_clock_RemoveClockStateSink(IMFPresentationClock *i
{ {
IMFClockStateSink_Release(sink->state_sink); IMFClockStateSink_Release(sink->state_sink);
list_remove(&sink->entry); list_remove(&sink->entry);
heap_free(sink); free(sink);
break; break;
} }
} }
...@@ -868,7 +865,7 @@ static ULONG WINAPI clock_timer_Release(IUnknown *iface) ...@@ -868,7 +865,7 @@ static ULONG WINAPI clock_timer_Release(IUnknown *iface)
{ {
IMFAsyncResult_Release(timer->result); IMFAsyncResult_Release(timer->result);
IMFAsyncCallback_Release(timer->callback); IMFAsyncCallback_Release(timer->callback);
heap_free(timer); free(timer);
} }
return refcount; return refcount;
...@@ -890,12 +887,12 @@ static HRESULT WINAPI present_clock_timer_SetTimer(IMFTimer *iface, DWORD flags, ...@@ -890,12 +887,12 @@ static HRESULT WINAPI present_clock_timer_SetTimer(IMFTimer *iface, DWORD flags,
TRACE("%p, %#x, %s, %p, %p, %p.\n", iface, flags, debugstr_time(time), callback, state, cancel_key); TRACE("%p, %#x, %s, %p, %p, %p.\n", iface, flags, debugstr_time(time), callback, state, cancel_key);
if (!(clock_timer = heap_alloc_zero(sizeof(*clock_timer)))) if (!(clock_timer = calloc(1, sizeof(*clock_timer))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = MFCreateAsyncResult(NULL, NULL, state, &clock_timer->result))) if (FAILED(hr = MFCreateAsyncResult(NULL, NULL, state, &clock_timer->result)))
{ {
heap_free(clock_timer); free(clock_timer);
return hr; return hr;
} }
...@@ -1140,8 +1137,7 @@ HRESULT WINAPI MFCreatePresentationClock(IMFPresentationClock **clock) ...@@ -1140,8 +1137,7 @@ HRESULT WINAPI MFCreatePresentationClock(IMFPresentationClock **clock)
TRACE("%p.\n", clock); TRACE("%p.\n", clock);
object = heap_alloc_zero(sizeof(*object)); if (!(object = calloc(1, sizeof(*object))))
if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFPresentationClock_iface.lpVtbl = &presentationclockvtbl; object->IMFPresentationClock_iface.lpVtbl = &presentationclockvtbl;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "mf_private.h" #include "mf_private.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat); WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
...@@ -92,7 +91,7 @@ static ULONG WINAPI sample_copier_transform_Release(IMFTransform *iface) ...@@ -92,7 +91,7 @@ static ULONG WINAPI sample_copier_transform_Release(IMFTransform *iface)
if (transform->buffer_type) if (transform->buffer_type)
IMFMediaType_Release(transform->buffer_type); IMFMediaType_Release(transform->buffer_type);
DeleteCriticalSection(&transform->cs); DeleteCriticalSection(&transform->cs);
heap_free(transform); free(transform);
} }
return refcount; return refcount;
...@@ -576,8 +575,7 @@ HRESULT WINAPI MFCreateSampleCopierMFT(IMFTransform **transform) ...@@ -576,8 +575,7 @@ HRESULT WINAPI MFCreateSampleCopierMFT(IMFTransform **transform)
TRACE("%p.\n", transform); TRACE("%p.\n", transform);
object = heap_alloc_zero(sizeof(*object)); if (!(object = calloc(1, sizeof(*object))))
if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFTransform_iface.lpVtbl = &sample_copier_transform_vtbl; object->IMFTransform_iface.lpVtbl = &sample_copier_transform_vtbl;
......
...@@ -286,7 +286,7 @@ static ULONG WINAPI video_stream_sink_Release(IMFStreamSink *iface) ...@@ -286,7 +286,7 @@ static ULONG WINAPI video_stream_sink_Release(IMFStreamSink *iface)
if (stream->allocator) if (stream->allocator)
IMFVideoSampleAllocator_Release(stream->allocator); IMFVideoSampleAllocator_Release(stream->allocator);
DeleteCriticalSection(&stream->cs); DeleteCriticalSection(&stream->cs);
heap_free(stream); free(stream);
} }
return refcount; return refcount;
...@@ -1053,7 +1053,7 @@ static HRESULT video_renderer_stream_create(struct video_renderer *renderer, uns ...@@ -1053,7 +1053,7 @@ static HRESULT video_renderer_stream_create(struct video_renderer *renderer, uns
unsigned int value; unsigned int value;
HRESULT hr; HRESULT hr;
if (!(stream = heap_alloc_zero(sizeof(*stream)))) if (!(stream = calloc(1, sizeof(*stream))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
stream->IMFStreamSink_iface.lpVtbl = &video_stream_sink_vtbl; stream->IMFStreamSink_iface.lpVtbl = &video_stream_sink_vtbl;
...@@ -1179,7 +1179,7 @@ static ULONG WINAPI video_renderer_sink_Release(IMFMediaSink *iface) ...@@ -1179,7 +1179,7 @@ static ULONG WINAPI video_renderer_sink_Release(IMFMediaSink *iface)
if (renderer->attributes) if (renderer->attributes)
IMFAttributes_Release(renderer->attributes); IMFAttributes_Release(renderer->attributes);
DeleteCriticalSection(&renderer->cs); DeleteCriticalSection(&renderer->cs);
heap_free(renderer); free(renderer);
} }
return refcount; return refcount;
...@@ -1456,7 +1456,7 @@ static HRESULT WINAPI video_renderer_sink_Shutdown(IMFMediaSink *iface) ...@@ -1456,7 +1456,7 @@ static HRESULT WINAPI video_renderer_sink_Shutdown(IMFMediaSink *iface)
IMFMediaSink_Release(iface); IMFMediaSink_Release(iface);
renderer->streams[i] = NULL; renderer->streams[i] = NULL;
} }
heap_free(renderer->streams); free(renderer->streams);
renderer->stream_count = 0; renderer->stream_count = 0;
renderer->stream_size = 0; renderer->stream_size = 0;
IMFMediaEventQueue_Shutdown(renderer->event_queue); IMFMediaEventQueue_Shutdown(renderer->event_queue);
...@@ -1637,8 +1637,8 @@ static HRESULT video_renderer_configure_mixer(struct video_renderer *renderer) ...@@ -1637,8 +1637,8 @@ static HRESULT video_renderer_configure_mixer(struct video_renderer *renderer)
/* Create stream sinks for inputs that mixer already has by default. */ /* Create stream sinks for inputs that mixer already has by default. */
if (SUCCEEDED(IMFTransform_GetStreamCount(renderer->mixer, &input_count, &output_count))) if (SUCCEEDED(IMFTransform_GetStreamCount(renderer->mixer, &input_count, &output_count)))
{ {
ids = heap_calloc(input_count, sizeof(*ids)); ids = calloc(input_count, sizeof(*ids));
oids = heap_calloc(output_count, sizeof(*oids)); oids = calloc(output_count, sizeof(*oids));
if (ids && oids) if (ids && oids)
{ {
...@@ -1652,8 +1652,8 @@ static HRESULT video_renderer_configure_mixer(struct video_renderer *renderer) ...@@ -1652,8 +1652,8 @@ static HRESULT video_renderer_configure_mixer(struct video_renderer *renderer)
} }
heap_free(ids); free(ids);
heap_free(oids); free(oids);
} }
} }
...@@ -2766,7 +2766,7 @@ static HRESULT evr_create_object(IMFAttributes *attributes, void *user_context, ...@@ -2766,7 +2766,7 @@ static HRESULT evr_create_object(IMFAttributes *attributes, void *user_context,
TRACE("%p, %p, %p.\n", attributes, user_context, obj); TRACE("%p, %p, %p.\n", attributes, user_context, obj);
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFMediaSink_iface.lpVtbl = &video_renderer_sink_vtbl; object->IMFMediaSink_iface.lpVtbl = &video_renderer_sink_vtbl;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "mf_private.h" #include "mf_private.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat); WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
...@@ -93,7 +92,7 @@ static ULONG WINAPI activate_object_Release(IMFActivate *iface) ...@@ -93,7 +92,7 @@ static ULONG WINAPI activate_object_Release(IMFActivate *iface)
if (activate->object) if (activate->object)
IUnknown_Release(activate->object); IUnknown_Release(activate->object);
IMFAttributes_Release(activate->attributes); IMFAttributes_Release(activate->attributes);
heap_free(activate); free(activate);
} }
return refcount; return refcount;
...@@ -461,15 +460,14 @@ HRESULT create_activation_object(void *context, const struct activate_funcs *fun ...@@ -461,15 +460,14 @@ HRESULT create_activation_object(void *context, const struct activate_funcs *fun
struct activate_object *object; struct activate_object *object;
HRESULT hr; HRESULT hr;
object = heap_alloc_zero(sizeof(*object)); if (!(object = calloc(1, sizeof(*object))))
if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFActivate_iface.lpVtbl = &activate_object_vtbl; object->IMFActivate_iface.lpVtbl = &activate_object_vtbl;
object->refcount = 1; object->refcount = 1;
if (FAILED(hr = MFCreateAttributes(&object->attributes, 0))) if (FAILED(hr = MFCreateAttributes(&object->attributes, 0)))
{ {
heap_free(object); free(object);
return hr; return hr;
} }
object->funcs = funcs; object->funcs = funcs;
...@@ -620,12 +618,12 @@ static ULONG WINAPI file_scheme_handler_Release(IMFSchemeHandler *iface) ...@@ -620,12 +618,12 @@ static ULONG WINAPI file_scheme_handler_Release(IMFSchemeHandler *iface)
IMFAsyncResult_Release(result->result); IMFAsyncResult_Release(result->result);
if (result->object) if (result->object)
IUnknown_Release(result->object); IUnknown_Release(result->object);
heap_free(result); free(result);
} }
DeleteCriticalSection(&handler->cs); DeleteCriticalSection(&handler->cs);
if (handler->resolver) if (handler->resolver)
IMFSourceResolver_Release(handler->resolver); IMFSourceResolver_Release(handler->resolver);
heap_free(handler); free(handler);
} }
return refcount; return refcount;
...@@ -683,8 +681,8 @@ static ULONG WINAPI create_object_context_Release(IUnknown *iface) ...@@ -683,8 +681,8 @@ static ULONG WINAPI create_object_context_Release(IUnknown *iface)
{ {
if (context->props) if (context->props)
IPropertyStore_Release(context->props); IPropertyStore_Release(context->props);
heap_free(context->url); free(context->url);
heap_free(context); free(context);
} }
return refcount; return refcount;
...@@ -697,23 +695,6 @@ static const IUnknownVtbl create_object_context_vtbl = ...@@ -697,23 +695,6 @@ static const IUnknownVtbl create_object_context_vtbl =
create_object_context_Release, create_object_context_Release,
}; };
static WCHAR *heap_strdupW(const WCHAR *str)
{
WCHAR *ret = NULL;
if (str)
{
unsigned int size;
size = (lstrlenW(str) + 1) * sizeof(WCHAR);
ret = heap_alloc(size);
if (ret)
memcpy(ret, str, size);
}
return ret;
}
static HRESULT WINAPI file_scheme_handler_BeginCreateObject(IMFSchemeHandler *iface, const WCHAR *url, DWORD flags, static HRESULT WINAPI file_scheme_handler_BeginCreateObject(IMFSchemeHandler *iface, const WCHAR *url, DWORD flags,
IPropertyStore *props, IUnknown **cancel_cookie, IMFAsyncCallback *callback, IUnknown *state) IPropertyStore *props, IUnknown **cancel_cookie, IMFAsyncCallback *callback, IUnknown *state)
{ {
...@@ -730,8 +711,7 @@ static HRESULT WINAPI file_scheme_handler_BeginCreateObject(IMFSchemeHandler *if ...@@ -730,8 +711,7 @@ static HRESULT WINAPI file_scheme_handler_BeginCreateObject(IMFSchemeHandler *if
if (FAILED(hr = MFCreateAsyncResult(NULL, callback, state, &caller))) if (FAILED(hr = MFCreateAsyncResult(NULL, callback, state, &caller)))
return hr; return hr;
context = heap_alloc(sizeof(*context)); if (!(context = malloc(sizeof(*context))))
if (!context)
{ {
IMFAsyncResult_Release(caller); IMFAsyncResult_Release(caller);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -743,7 +723,7 @@ static HRESULT WINAPI file_scheme_handler_BeginCreateObject(IMFSchemeHandler *if ...@@ -743,7 +723,7 @@ static HRESULT WINAPI file_scheme_handler_BeginCreateObject(IMFSchemeHandler *if
if (context->props) if (context->props)
IPropertyStore_AddRef(context->props); IPropertyStore_AddRef(context->props);
context->flags = flags; context->flags = flags;
context->url = heap_strdupW(url); context->url = wcsdup(url);
if (!context->url) if (!context->url)
{ {
IMFAsyncResult_Release(caller); IMFAsyncResult_Release(caller);
...@@ -800,7 +780,7 @@ static HRESULT WINAPI file_scheme_handler_EndCreateObject(IMFSchemeHandler *ifac ...@@ -800,7 +780,7 @@ static HRESULT WINAPI file_scheme_handler_EndCreateObject(IMFSchemeHandler *ifac
*object = found->object; *object = found->object;
hr = IMFAsyncResult_GetStatus(found->result); hr = IMFAsyncResult_GetStatus(found->result);
IMFAsyncResult_Release(found->result); IMFAsyncResult_Release(found->result);
heap_free(found); free(found);
} }
else else
{ {
...@@ -838,7 +818,7 @@ static HRESULT WINAPI file_scheme_handler_CancelObjectCreation(IMFSchemeHandler ...@@ -838,7 +818,7 @@ static HRESULT WINAPI file_scheme_handler_CancelObjectCreation(IMFSchemeHandler
IMFAsyncResult_Release(found->result); IMFAsyncResult_Release(found->result);
if (found->object) if (found->object)
IUnknown_Release(found->object); IUnknown_Release(found->object);
heap_free(found); free(found);
} }
return found ? S_OK : MF_E_UNEXPECTED; return found ? S_OK : MF_E_UNEXPECTED;
...@@ -957,7 +937,7 @@ static HRESULT WINAPI file_scheme_handler_callback_Invoke(IMFAsyncCallback *ifac ...@@ -957,7 +937,7 @@ static HRESULT WINAPI file_scheme_handler_callback_Invoke(IMFAsyncCallback *ifac
} }
} }
handler_result = heap_alloc(sizeof(*handler_result)); handler_result = malloc(sizeof(*handler_result));
if (handler_result) if (handler_result)
{ {
handler_result->result = caller; handler_result->result = caller;
...@@ -1000,8 +980,7 @@ static HRESULT file_scheme_handler_construct(REFIID riid, void **obj) ...@@ -1000,8 +980,7 @@ static HRESULT file_scheme_handler_construct(REFIID riid, void **obj)
TRACE("%s, %p.\n", debugstr_guid(riid), obj); TRACE("%s, %p.\n", debugstr_guid(riid), obj);
handler = heap_alloc_zero(sizeof(*handler)); if (!(handler = calloc(1, sizeof(*handler))))
if (!handler)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
handler->IMFSchemeHandler_iface.lpVtbl = &file_scheme_handler_vtbl; handler->IMFSchemeHandler_iface.lpVtbl = &file_scheme_handler_vtbl;
...@@ -1098,8 +1077,7 @@ static HRESULT mf_get_handler_strings(const WCHAR *path, WCHAR filter, unsigned ...@@ -1098,8 +1077,7 @@ static HRESULT mf_get_handler_strings(const WCHAR *path, WCHAR filter, unsigned
int i, index; int i, index;
WCHAR *buffW; WCHAR *buffW;
buffW = heap_calloc(maxlen, sizeof(*buffW)); if (!(buffW = calloc(maxlen, sizeof(*buffW))))
if (!buffW)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memset(dst, 0, sizeof(*dst)); memset(dst, 0, sizeof(*dst));
...@@ -1135,7 +1113,7 @@ static HRESULT mf_get_handler_strings(const WCHAR *path, WCHAR filter, unsigned ...@@ -1135,7 +1113,7 @@ static HRESULT mf_get_handler_strings(const WCHAR *path, WCHAR filter, unsigned
if (FAILED(hr)) if (FAILED(hr))
PropVariantClear(dst); PropVariantClear(dst);
heap_free(buffW); free(buffW);
return hr; return hr;
} }
...@@ -1276,7 +1254,7 @@ static ULONG WINAPI simple_type_handler_Release(IMFMediaTypeHandler *iface) ...@@ -1276,7 +1254,7 @@ static ULONG WINAPI simple_type_handler_Release(IMFMediaTypeHandler *iface)
if (handler->media_type) if (handler->media_type)
IMFMediaType_Release(handler->media_type); IMFMediaType_Release(handler->media_type);
DeleteCriticalSection(&handler->cs); DeleteCriticalSection(&handler->cs);
heap_free(handler); free(handler);
} }
return refcount; return refcount;
...@@ -1410,8 +1388,7 @@ HRESULT WINAPI MFCreateSimpleTypeHandler(IMFMediaTypeHandler **handler) ...@@ -1410,8 +1388,7 @@ HRESULT WINAPI MFCreateSimpleTypeHandler(IMFMediaTypeHandler **handler)
TRACE("%p.\n", handler); TRACE("%p.\n", handler);
object = heap_alloc_zero(sizeof(*object)); if (!(object = calloc(1, sizeof(*object))))
if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFMediaTypeHandler_iface.lpVtbl = &simple_type_handler_vtbl; object->IMFMediaTypeHandler_iface.lpVtbl = &simple_type_handler_vtbl;
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "mfidl.h" #include "mfidl.h"
#include "mfapi.h" #include "mfapi.h"
#include "wine/heap.h"
#include "wine/debug.h" #include "wine/debug.h"
static inline BOOL mf_array_reserve(void **elements, size_t *capacity, size_t count, size_t size) static inline BOOL mf_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
...@@ -41,7 +40,7 @@ static inline BOOL mf_array_reserve(void **elements, size_t *capacity, size_t co ...@@ -41,7 +40,7 @@ static inline BOOL mf_array_reserve(void **elements, size_t *capacity, size_t co
if (new_capacity < count) if (new_capacity < count)
new_capacity = max_capacity; new_capacity = max_capacity;
if (!(new_elements = heap_realloc(*elements, new_capacity * size))) if (!(new_elements = realloc(*elements, new_capacity * size)))
return FALSE; return FALSE;
*elements = new_elements; *elements = new_elements;
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "mf_private.h" #include "mf_private.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat); WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
...@@ -105,7 +104,7 @@ static void sample_grabber_free_private(void *user_context) ...@@ -105,7 +104,7 @@ static void sample_grabber_free_private(void *user_context)
struct sample_grabber_activate_context *context = user_context; struct sample_grabber_activate_context *context = user_context;
IMFMediaType_Release(context->media_type); IMFMediaType_Release(context->media_type);
IMFSampleGrabberSinkCallback_Release(context->callback); IMFSampleGrabberSinkCallback_Release(context->callback);
heap_free(context); free(context);
} }
static struct sample_grabber *impl_from_IMFMediaSink(IMFMediaSink *iface) static struct sample_grabber *impl_from_IMFMediaSink(IMFMediaSink *iface)
...@@ -194,7 +193,7 @@ static void stream_release_pending_item(struct scheduled_item *item) ...@@ -194,7 +193,7 @@ static void stream_release_pending_item(struct scheduled_item *item)
PropVariantClear(&item->u.marker.context); PropVariantClear(&item->u.marker.context);
break; break;
} }
heap_free(item); free(item);
} }
static ULONG WINAPI sample_grabber_stream_Release(IMFStreamSink *iface) static ULONG WINAPI sample_grabber_stream_Release(IMFStreamSink *iface)
...@@ -386,7 +385,7 @@ static HRESULT stream_queue_sample(struct sample_grabber *grabber, IMFSample *sa ...@@ -386,7 +385,7 @@ static HRESULT stream_queue_sample(struct sample_grabber *grabber, IMFSample *sa
if (FAILED(hr = IMFSample_GetSampleTime(sample, &sampletime))) if (FAILED(hr = IMFSample_GetSampleTime(sample, &sampletime)))
return hr; return hr;
if (!(item = heap_alloc_zero(sizeof(*item)))) if (!(item = calloc(1, sizeof(*item))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
item->type = ITEM_TYPE_SAMPLE; item->type = ITEM_TYPE_SAMPLE;
...@@ -467,7 +466,7 @@ static HRESULT stream_place_marker(struct sample_grabber *grabber, MFSTREAMSINK_ ...@@ -467,7 +466,7 @@ static HRESULT stream_place_marker(struct sample_grabber *grabber, MFSTREAMSINK_
return S_OK; return S_OK;
} }
if (!(item = heap_alloc_zero(sizeof(*item)))) if (!(item = calloc(1, sizeof(*item))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
item->type = ITEM_TYPE_MARKER; item->type = ITEM_TYPE_MARKER;
...@@ -866,7 +865,7 @@ static ULONG WINAPI sample_grabber_sink_Release(IMFMediaSink *iface) ...@@ -866,7 +865,7 @@ static ULONG WINAPI sample_grabber_sink_Release(IMFMediaSink *iface)
IMFAttributes_Release(grabber->sample_attributes); IMFAttributes_Release(grabber->sample_attributes);
sample_grabber_release_pending_items(grabber); sample_grabber_release_pending_items(grabber);
DeleteCriticalSection(&grabber->cs); DeleteCriticalSection(&grabber->cs);
heap_free(grabber); free(grabber);
} }
return refcount; return refcount;
...@@ -1401,8 +1400,7 @@ static HRESULT sample_grabber_create_object(IMFAttributes *attributes, void *use ...@@ -1401,8 +1400,7 @@ static HRESULT sample_grabber_create_object(IMFAttributes *attributes, void *use
if (FAILED(IMFMediaType_GetMajorType(context->media_type, &guid))) if (FAILED(IMFMediaType_GetMajorType(context->media_type, &guid)))
return MF_E_INVALIDMEDIATYPE; return MF_E_INVALIDMEDIATYPE;
object = heap_alloc_zero(sizeof(*object)); if (!(object = calloc(1, sizeof(*object))))
if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFMediaSink_iface.lpVtbl = &sample_grabber_sink_vtbl; object->IMFMediaSink_iface.lpVtbl = &sample_grabber_sink_vtbl;
...@@ -1478,8 +1476,7 @@ HRESULT WINAPI MFCreateSampleGrabberSinkActivate(IMFMediaType *media_type, IMFSa ...@@ -1478,8 +1476,7 @@ HRESULT WINAPI MFCreateSampleGrabberSinkActivate(IMFMediaType *media_type, IMFSa
if (!media_type || !callback || !activate) if (!media_type || !callback || !activate)
return E_POINTER; return E_POINTER;
context = heap_alloc_zero(sizeof(*context)); if (!(context = calloc(1, sizeof(*context))))
if (!context)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
context->media_type = media_type; context->media_type = media_type;
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "audioclient.h" #include "audioclient.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat); WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
...@@ -121,7 +120,7 @@ static void release_pending_object(struct queued_object *object) ...@@ -121,7 +120,7 @@ static void release_pending_object(struct queued_object *object)
PropVariantClear(&object->u.marker.context); PropVariantClear(&object->u.marker.context);
break; break;
} }
heap_free(object); free(object);
} }
static struct audio_renderer *impl_from_IMFMediaSink(IMFMediaSink *iface) static struct audio_renderer *impl_from_IMFMediaSink(IMFMediaSink *iface)
...@@ -279,7 +278,7 @@ static ULONG WINAPI audio_renderer_sink_Release(IMFMediaSink *iface) ...@@ -279,7 +278,7 @@ static ULONG WINAPI audio_renderer_sink_Release(IMFMediaSink *iface)
audio_renderer_release_audio_client(renderer); audio_renderer_release_audio_client(renderer);
CloseHandle(renderer->buffer_ready_event); CloseHandle(renderer->buffer_ready_event);
DeleteCriticalSection(&renderer->cs); DeleteCriticalSection(&renderer->cs);
heap_free(renderer); free(renderer);
} }
return refcount; return refcount;
...@@ -1332,7 +1331,7 @@ static HRESULT stream_queue_sample(struct audio_renderer *renderer, IMFSample *s ...@@ -1332,7 +1331,7 @@ static HRESULT stream_queue_sample(struct audio_renderer *renderer, IMFSample *s
{ {
struct queued_object *object; struct queued_object *object;
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->type = OBJECT_TYPE_SAMPLE; object->type = OBJECT_TYPE_SAMPLE;
...@@ -1372,7 +1371,7 @@ static HRESULT stream_place_marker(struct audio_renderer *renderer, MFSTREAMSINK ...@@ -1372,7 +1371,7 @@ static HRESULT stream_place_marker(struct audio_renderer *renderer, MFSTREAMSINK
struct queued_object *marker; struct queued_object *marker;
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!(marker = heap_alloc_zero(sizeof(*marker)))) if (!(marker = calloc(1, sizeof(*marker))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
marker->type = OBJECT_TYPE_MARKER; marker->type = OBJECT_TYPE_MARKER;
...@@ -1843,7 +1842,7 @@ static HRESULT sar_create_object(IMFAttributes *attributes, void *user_context, ...@@ -1843,7 +1842,7 @@ static HRESULT sar_create_object(IMFAttributes *attributes, void *user_context,
TRACE("%p, %p, %p.\n", attributes, user_context, obj); TRACE("%p, %p, %p.\n", attributes, user_context, obj);
if (!(renderer = heap_alloc_zero(sizeof(*renderer)))) if (!(renderer = calloc(1, sizeof(*renderer))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
renderer->IMFMediaSink_iface.lpVtbl = &audio_renderer_sink_vtbl; renderer->IMFMediaSink_iface.lpVtbl = &audio_renderer_sink_vtbl;
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "evr.h" #include "evr.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
#include "mf_private.h" #include "mf_private.h"
...@@ -431,7 +430,7 @@ static ULONG WINAPI session_op_Release(IUnknown *iface) ...@@ -431,7 +430,7 @@ static ULONG WINAPI session_op_Release(IUnknown *iface)
default: default:
; ;
} }
heap_free(op); free(op);
} }
return refcount; return refcount;
...@@ -448,7 +447,7 @@ static HRESULT create_session_op(enum session_command command, struct session_op ...@@ -448,7 +447,7 @@ static HRESULT create_session_op(enum session_command command, struct session_op
{ {
struct session_op *op; struct session_op *op;
if (!(op = heap_alloc_zero(sizeof(*op)))) if (!(op = calloc(1, sizeof(*op))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
op->IUnknown_iface.lpVtbl = &session_op_vtbl; op->IUnknown_iface.lpVtbl = &session_op_vtbl;
...@@ -511,7 +510,7 @@ static void session_clear_topologies(struct media_session *session) ...@@ -511,7 +510,7 @@ static void session_clear_topologies(struct media_session *session)
{ {
list_remove(&ptr->entry); list_remove(&ptr->entry);
IMFTopology_Release(ptr->topology); IMFTopology_Release(ptr->topology);
heap_free(ptr); free(ptr);
} }
} }
...@@ -640,7 +639,7 @@ static void transform_release_sample(struct sample *sample) ...@@ -640,7 +639,7 @@ static void transform_release_sample(struct sample *sample)
list_remove(&sample->entry); list_remove(&sample->entry);
if (sample->sample) if (sample->sample)
IMFSample_Release(sample->sample); IMFSample_Release(sample->sample);
heap_free(sample); free(sample);
} }
static void transform_stream_drop_samples(struct transform_stream *stream) static void transform_stream_drop_samples(struct transform_stream *stream)
...@@ -666,10 +665,10 @@ static void release_topo_node(struct topo_node *node) ...@@ -666,10 +665,10 @@ static void release_topo_node(struct topo_node *node)
transform_stream_drop_samples(&node->u.transform.inputs[i]); transform_stream_drop_samples(&node->u.transform.inputs[i]);
for (i = 0; i < node->u.transform.output_count; ++i) for (i = 0; i < node->u.transform.output_count; ++i)
transform_stream_drop_samples(&node->u.transform.outputs[i]); transform_stream_drop_samples(&node->u.transform.outputs[i]);
heap_free(node->u.transform.inputs); free(node->u.transform.inputs);
heap_free(node->u.transform.outputs); free(node->u.transform.outputs);
heap_free(node->u.transform.input_map); free(node->u.transform.input_map);
heap_free(node->u.transform.output_map); free(node->u.transform.output_map);
break; break;
case MF_TOPOLOGY_OUTPUT_NODE: case MF_TOPOLOGY_OUTPUT_NODE:
if (node->u.sink.allocator) if (node->u.sink.allocator)
...@@ -688,7 +687,7 @@ static void release_topo_node(struct topo_node *node) ...@@ -688,7 +687,7 @@ static void release_topo_node(struct topo_node *node)
IUnknown_Release(node->object.object); IUnknown_Release(node->object.object);
if (node->node) if (node->node)
IMFTopologyNode_Release(node->node); IMFTopologyNode_Release(node->node);
heap_free(node); free(node);
} }
static void session_shutdown_current_topology(struct media_session *session) static void session_shutdown_current_topology(struct media_session *session)
...@@ -771,7 +770,7 @@ static void session_clear_presentation(struct media_session *session) ...@@ -771,7 +770,7 @@ static void session_clear_presentation(struct media_session *session)
IMFMediaSource_Release(source->source); IMFMediaSource_Release(source->source);
if (source->pd) if (source->pd)
IMFPresentationDescriptor_Release(source->pd); IMFPresentationDescriptor_Release(source->pd);
heap_free(source); free(source);
} }
LIST_FOR_EACH_ENTRY_SAFE(node, node2, &session->presentation.nodes, struct topo_node, entry) LIST_FOR_EACH_ENTRY_SAFE(node, node2, &session->presentation.nodes, struct topo_node, entry)
...@@ -790,7 +789,7 @@ static void session_clear_presentation(struct media_session *session) ...@@ -790,7 +789,7 @@ static void session_clear_presentation(struct media_session *session)
IMFMediaSinkPreroll_Release(sink->preroll); IMFMediaSinkPreroll_Release(sink->preroll);
if (sink->event_generator) if (sink->event_generator)
IMFMediaEventGenerator_Release(sink->event_generator); IMFMediaEventGenerator_Release(sink->event_generator);
heap_free(sink); free(sink);
} }
} }
...@@ -1078,7 +1077,7 @@ static void session_release_media_source(struct media_source *source) ...@@ -1078,7 +1077,7 @@ static void session_release_media_source(struct media_source *source)
IMFMediaSource_Release(source->source); IMFMediaSource_Release(source->source);
if (source->pd) if (source->pd)
IMFPresentationDescriptor_Release(source->pd); IMFPresentationDescriptor_Release(source->pd);
heap_free(source); free(source);
} }
static HRESULT session_add_media_source(struct media_session *session, IMFTopologyNode *node, IMFMediaSource *source) static HRESULT session_add_media_source(struct media_session *session, IMFTopologyNode *node, IMFMediaSource *source)
...@@ -1089,7 +1088,7 @@ static HRESULT session_add_media_source(struct media_session *session, IMFTopolo ...@@ -1089,7 +1088,7 @@ static HRESULT session_add_media_source(struct media_session *session, IMFTopolo
if (session_get_media_source(session, source)) if (session_get_media_source(session, source))
return S_FALSE; return S_FALSE;
if (!(media_source = heap_alloc_zero(sizeof(*media_source)))) if (!(media_source = calloc(1, sizeof(*media_source))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
media_source->source = source; media_source->source = source;
...@@ -1150,7 +1149,7 @@ static HRESULT session_add_media_sink(struct media_session *session, IMFTopology ...@@ -1150,7 +1149,7 @@ static HRESULT session_add_media_sink(struct media_session *session, IMFTopology
return S_FALSE; return S_FALSE;
} }
if (!(media_sink = heap_alloc_zero(sizeof(*media_sink)))) if (!(media_sink = calloc(1, sizeof(*media_sink))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
media_sink->sink = sink; media_sink->sink = sink;
...@@ -1188,14 +1187,14 @@ static HRESULT session_set_transform_stream_info(struct topo_node *node) ...@@ -1188,14 +1187,14 @@ static HRESULT session_set_transform_stream_info(struct topo_node *node)
hr = IMFTransform_GetStreamCount(node->object.transform, &input_count, &output_count); hr = IMFTransform_GetStreamCount(node->object.transform, &input_count, &output_count);
if (SUCCEEDED(hr) && (input_count > 1 || output_count > 1)) if (SUCCEEDED(hr) && (input_count > 1 || output_count > 1))
{ {
input_map = heap_calloc(input_count, sizeof(*input_map)); input_map = calloc(input_count, sizeof(*input_map));
output_map = heap_calloc(output_count, sizeof(*output_map)); output_map = calloc(output_count, sizeof(*output_map));
if (FAILED(IMFTransform_GetStreamIDs(node->object.transform, input_count, input_map, if (FAILED(IMFTransform_GetStreamIDs(node->object.transform, input_count, input_map,
output_count, output_map))) output_count, output_map)))
{ {
/* Assume sequential identifiers. */ /* Assume sequential identifiers. */
heap_free(input_map); free(input_map);
heap_free(output_map); free(output_map);
input_map = output_map = NULL; input_map = output_map = NULL;
} }
} }
...@@ -1205,13 +1204,13 @@ static HRESULT session_set_transform_stream_info(struct topo_node *node) ...@@ -1205,13 +1204,13 @@ static HRESULT session_set_transform_stream_info(struct topo_node *node)
node->u.transform.input_map = input_map; node->u.transform.input_map = input_map;
node->u.transform.output_map = output_map; node->u.transform.output_map = output_map;
streams = heap_calloc(input_count, sizeof(*streams)); streams = calloc(input_count, sizeof(*streams));
for (i = 0; i < input_count; ++i) for (i = 0; i < input_count; ++i)
list_init(&streams[i].samples); list_init(&streams[i].samples);
node->u.transform.inputs = streams; node->u.transform.inputs = streams;
node->u.transform.input_count = input_count; node->u.transform.input_count = input_count;
streams = heap_calloc(output_count, sizeof(*streams)); streams = calloc(output_count, sizeof(*streams));
for (i = 0; i < output_count; ++i) for (i = 0; i < output_count; ++i)
{ {
list_init(&streams[i].samples); list_init(&streams[i].samples);
...@@ -1306,7 +1305,7 @@ static HRESULT session_append_node(struct media_session *session, IMFTopologyNod ...@@ -1306,7 +1305,7 @@ static HRESULT session_append_node(struct media_session *session, IMFTopologyNod
IMFStreamDescriptor *sd; IMFStreamDescriptor *sd;
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!(topo_node = heap_alloc_zero(sizeof(*topo_node)))) if (!(topo_node = calloc(1, sizeof(*topo_node))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
IMFTopologyNode_GetNodeType(node, &topo_node->type); IMFTopologyNode_GetNodeType(node, &topo_node->type);
...@@ -1573,7 +1572,7 @@ static void session_set_topology(struct media_session *session, DWORD flags, IMF ...@@ -1573,7 +1572,7 @@ static void session_set_topology(struct media_session *session, DWORD flags, IMF
{ {
struct queued_topology *queued_topology; struct queued_topology *queued_topology;
if ((queued_topology = heap_alloc_zero(sizeof(*queued_topology)))) if ((queued_topology = calloc(1, sizeof(*queued_topology))))
{ {
queued_topology->topology = topology; queued_topology->topology = topology;
IMFTopology_AddRef(queued_topology->topology); IMFTopology_AddRef(queued_topology->topology);
...@@ -1655,7 +1654,7 @@ static ULONG WINAPI mfsession_Release(IMFMediaSession *iface) ...@@ -1655,7 +1654,7 @@ static ULONG WINAPI mfsession_Release(IMFMediaSession *iface)
if (session->quality_manager) if (session->quality_manager)
IMFQualityManager_Release(session->quality_manager); IMFQualityManager_Release(session->quality_manager);
DeleteCriticalSection(&session->cs); DeleteCriticalSection(&session->cs);
heap_free(session); free(session);
} }
return refcount; return refcount;
...@@ -2596,7 +2595,7 @@ static void session_set_sink_stream_state(struct media_session *session, IMFStre ...@@ -2596,7 +2595,7 @@ static void session_set_sink_stream_state(struct media_session *session, IMFStre
static struct sample *transform_create_sample(IMFSample *sample) static struct sample *transform_create_sample(IMFSample *sample)
{ {
struct sample *sample_entry = heap_alloc_zero(sizeof(*sample_entry)); struct sample *sample_entry = calloc(1, sizeof(*sample_entry));
if (sample_entry) if (sample_entry)
{ {
...@@ -2660,7 +2659,7 @@ static HRESULT transform_node_pull_samples(const struct media_session *session, ...@@ -2660,7 +2659,7 @@ static HRESULT transform_node_pull_samples(const struct media_session *session,
unsigned int i; unsigned int i;
HRESULT hr = E_UNEXPECTED; HRESULT hr = E_UNEXPECTED;
if (!(buffers = heap_calloc(node->u.transform.output_count, sizeof(*buffers)))) if (!(buffers = calloc(node->u.transform.output_count, sizeof(*buffers))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
for (i = 0; i < node->u.transform.output_count; ++i) for (i = 0; i < node->u.transform.output_count; ++i)
...@@ -2703,7 +2702,7 @@ static HRESULT transform_node_pull_samples(const struct media_session *session, ...@@ -2703,7 +2702,7 @@ static HRESULT transform_node_pull_samples(const struct media_session *session,
IMFSample_Release(buffers[i].pSample); IMFSample_Release(buffers[i].pSample);
} }
heap_free(buffers); free(buffers);
return hr; return hr;
} }
...@@ -3611,8 +3610,7 @@ HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **ses ...@@ -3611,8 +3610,7 @@ HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **ses
TRACE("%p, %p.\n", config, session); TRACE("%p, %p.\n", config, session);
object = heap_alloc_zero(sizeof(*object)); if (!(object = calloc(1, sizeof(*object))))
if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFMediaSession_iface.lpVtbl = &mfmediasessionvtbl; object->IMFMediaSession_iface.lpVtbl = &mfmediasessionvtbl;
...@@ -3749,7 +3747,7 @@ static ULONG WINAPI standard_quality_manager_Release(IMFQualityManager *iface) ...@@ -3749,7 +3747,7 @@ static ULONG WINAPI standard_quality_manager_Release(IMFQualityManager *iface)
if (manager->topology) if (manager->topology)
IMFTopology_Release(manager->topology); IMFTopology_Release(manager->topology);
DeleteCriticalSection(&manager->cs); DeleteCriticalSection(&manager->cs);
heap_free(manager); free(manager);
} }
return refcount; return refcount;
...@@ -3941,8 +3939,7 @@ HRESULT WINAPI MFCreateStandardQualityManager(IMFQualityManager **manager) ...@@ -3941,8 +3939,7 @@ HRESULT WINAPI MFCreateStandardQualityManager(IMFQualityManager **manager)
TRACE("%p.\n", manager); TRACE("%p.\n", manager);
object = heap_alloc_zero(sizeof(*object)); if (!(object = calloc(1, sizeof(*object))))
if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFQualityManager_iface.lpVtbl = &standard_quality_manager_vtbl; object->IMFQualityManager_iface.lpVtbl = &standard_quality_manager_vtbl;
......
...@@ -256,7 +256,7 @@ static void topology_clear(struct topology *topology) ...@@ -256,7 +256,7 @@ static void topology_clear(struct topology *topology)
topology_node_disconnect(topology->nodes.nodes[i]); topology_node_disconnect(topology->nodes.nodes[i]);
IMFTopologyNode_Release(&topology->nodes.nodes[i]->IMFTopologyNode_iface); IMFTopologyNode_Release(&topology->nodes.nodes[i]->IMFTopologyNode_iface);
} }
heap_free(topology->nodes.nodes); free(topology->nodes.nodes);
topology->nodes.nodes = NULL; topology->nodes.nodes = NULL;
topology->nodes.count = 0; topology->nodes.count = 0;
topology->nodes.size = 0; topology->nodes.size = 0;
...@@ -274,7 +274,7 @@ static ULONG WINAPI topology_Release(IMFTopology *iface) ...@@ -274,7 +274,7 @@ static ULONG WINAPI topology_Release(IMFTopology *iface)
if (topology->attributes) if (topology->attributes)
IMFAttributes_Release(topology->attributes); IMFAttributes_Release(topology->attributes);
topology_clear(topology); topology_clear(topology);
heap_free(topology); free(topology);
} }
return refcount; return refcount;
...@@ -885,8 +885,7 @@ HRESULT WINAPI MFCreateTopology(IMFTopology **topology) ...@@ -885,8 +885,7 @@ HRESULT WINAPI MFCreateTopology(IMFTopology **topology)
if (!topology) if (!topology)
return E_POINTER; return E_POINTER;
object = heap_alloc_zero(sizeof(*object)); if (!(object = calloc(1, sizeof(*object))))
if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFTopology_iface.lpVtbl = &topologyvtbl; object->IMFTopology_iface.lpVtbl = &topologyvtbl;
...@@ -961,11 +960,11 @@ static ULONG WINAPI topology_node_Release(IMFTopologyNode *iface) ...@@ -961,11 +960,11 @@ static ULONG WINAPI topology_node_Release(IMFTopologyNode *iface)
if (node->outputs.streams[i].preferred_type) if (node->outputs.streams[i].preferred_type)
IMFMediaType_Release(node->outputs.streams[i].preferred_type); IMFMediaType_Release(node->outputs.streams[i].preferred_type);
} }
heap_free(node->inputs.streams); free(node->inputs.streams);
heap_free(node->outputs.streams); free(node->outputs.streams);
IMFAttributes_Release(node->attributes); IMFAttributes_Release(node->attributes);
DeleteCriticalSection(&node->cs); DeleteCriticalSection(&node->cs);
heap_free(node); free(node);
} }
return refcount; return refcount;
...@@ -1767,8 +1766,7 @@ static HRESULT create_topology_node(MF_TOPOLOGY_TYPE node_type, struct topology_ ...@@ -1767,8 +1766,7 @@ static HRESULT create_topology_node(MF_TOPOLOGY_TYPE node_type, struct topology_
{ {
HRESULT hr; HRESULT hr;
*node = heap_alloc_zero(sizeof(**node)); if (!(*node = calloc(1, sizeof(**node))))
if (!*node)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
(*node)->IMFTopologyNode_iface.lpVtbl = &topologynodevtbl; (*node)->IMFTopologyNode_iface.lpVtbl = &topologynodevtbl;
...@@ -1777,7 +1775,7 @@ static HRESULT create_topology_node(MF_TOPOLOGY_TYPE node_type, struct topology_ ...@@ -1777,7 +1775,7 @@ static HRESULT create_topology_node(MF_TOPOLOGY_TYPE node_type, struct topology_
hr = MFCreateAttributes(&(*node)->attributes, 0); hr = MFCreateAttributes(&(*node)->attributes, 0);
if (FAILED(hr)) if (FAILED(hr))
{ {
heap_free(*node); free(*node);
return hr; return hr;
} }
(*node)->id = ((TOPOID)GetCurrentProcessId() << 32) | InterlockedIncrement(&next_node_id); (*node)->id = ((TOPOID)GetCurrentProcessId() << 32) | InterlockedIncrement(&next_node_id);
...@@ -1931,9 +1929,7 @@ static ULONG WINAPI topology_loader_Release(IMFTopoLoader *iface) ...@@ -1931,9 +1929,7 @@ static ULONG WINAPI topology_loader_Release(IMFTopoLoader *iface)
TRACE("%p, refcount %u.\n", iface, refcount); TRACE("%p, refcount %u.\n", iface, refcount);
if (!refcount) if (!refcount)
{ free(loader);
heap_free(loader);
}
return refcount; return refcount;
} }
...@@ -2692,8 +2688,7 @@ HRESULT WINAPI MFCreateTopoLoader(IMFTopoLoader **loader) ...@@ -2692,8 +2688,7 @@ HRESULT WINAPI MFCreateTopoLoader(IMFTopoLoader **loader)
if (!loader) if (!loader)
return E_POINTER; return E_POINTER;
object = heap_alloc(sizeof(*object)); if (!(object = calloc(1, sizeof(*object))))
if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFTopoLoader_iface.lpVtbl = &topologyloadervtbl; object->IMFTopoLoader_iface.lpVtbl = &topologyloadervtbl;
...@@ -2751,9 +2746,7 @@ static ULONG WINAPI seq_source_Release(IMFSequencerSource *iface) ...@@ -2751,9 +2746,7 @@ static ULONG WINAPI seq_source_Release(IMFSequencerSource *iface)
TRACE("%p, refcount %u.\n", iface, refcount); TRACE("%p, refcount %u.\n", iface, refcount);
if (!refcount) if (!refcount)
{ free(seq_source);
heap_free(seq_source);
}
return refcount; return refcount;
} }
...@@ -2855,8 +2848,7 @@ HRESULT WINAPI MFCreateSequencerSource(IUnknown *reserved, IMFSequencerSource ** ...@@ -2855,8 +2848,7 @@ HRESULT WINAPI MFCreateSequencerSource(IUnknown *reserved, IMFSequencerSource **
if (!seq_source) if (!seq_source)
return E_POINTER; return E_POINTER;
object = heap_alloc(sizeof(*object)); if (!(object = calloc(1, sizeof(*object))))
if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFSequencerSource_iface.lpVtbl = &seqsourcevtbl; object->IMFSequencerSource_iface.lpVtbl = &seqsourcevtbl;
......
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