evr: Use CRT functions for heap allocations.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-04-08 12:18:11 +03:00 committed by Alexandre Julliard
parent 437bc14ac3
commit 195f735cbe
3 changed files with 19 additions and 22 deletions

View File

@ -31,7 +31,6 @@
#include "evcode.h" #include "evcode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(evr); WINE_DEFAULT_DEBUG_CHANNEL(evr);
@ -200,7 +199,7 @@ static void video_mixer_clear_types(struct video_mixer *mixer)
{ {
IMFMediaType_Release(mixer->output.rt_formats[i].media_type); IMFMediaType_Release(mixer->output.rt_formats[i].media_type);
} }
heap_free(mixer->output.rt_formats); free(mixer->output.rt_formats);
if (mixer->output.media_type) if (mixer->output.media_type)
IMFMediaType_Release(mixer->output.media_type); IMFMediaType_Release(mixer->output.media_type);
mixer->output.media_type = NULL; mixer->output.media_type = NULL;
@ -668,7 +667,7 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const
if (SUCCEEDED(IDirectXVideoProcessorService_GetVideoProcessorRenderTargets(service, &devices[i], video_desc, if (SUCCEEDED(IDirectXVideoProcessorService_GetVideoProcessorRenderTargets(service, &devices[i], video_desc,
&format_count, &formats))) &format_count, &formats)))
{ {
if (!(ptr = heap_realloc(rt_formats, (count + format_count) * sizeof(*rt_formats)))) if (!(ptr = realloc(rt_formats, (count + format_count) * sizeof(*rt_formats))))
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
count = 0; count = 0;
@ -703,7 +702,7 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const
count = j + 1; count = j + 1;
memcpy(&subtype, &MFVideoFormat_Base, sizeof(subtype)); memcpy(&subtype, &MFVideoFormat_Base, sizeof(subtype));
if ((mixer->output.rt_formats = heap_calloc(count, sizeof(*mixer->output.rt_formats)))) if ((mixer->output.rt_formats = calloc(count, sizeof(*mixer->output.rt_formats))))
{ {
for (i = 0; i < count; ++i) for (i = 0; i < count; ++i)
{ {
@ -727,7 +726,7 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const
} }
} }
heap_free(rt_formats); free(rt_formats);
return count ? S_OK : hr; return count ? S_OK : hr;
} }

View File

@ -28,7 +28,6 @@
#include "evr_private.h" #include "evr_private.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(evr); WINE_DEFAULT_DEBUG_CHANNEL(evr);
@ -369,7 +368,7 @@ static void video_presenter_sample_queue_init(struct video_presenter *presenter)
return; return;
memset(queue, 0, sizeof(*queue)); memset(queue, 0, sizeof(*queue));
queue->samples = heap_calloc(presenter->allocator_capacity, sizeof(*queue->samples)); queue->samples = calloc(presenter->allocator_capacity, sizeof(*queue->samples));
queue->size = presenter->allocator_capacity; queue->size = presenter->allocator_capacity;
queue->back = queue->size - 1; queue->back = queue->size - 1;
} }
@ -836,7 +835,7 @@ static ULONG WINAPI video_presenter_inner_Release(IUnknown *iface)
} }
if (presenter->allocator) if (presenter->allocator)
IMFVideoSampleAllocator_Release(presenter->allocator); IMFVideoSampleAllocator_Release(presenter->allocator);
heap_free(presenter); free(presenter);
} }
return refcount; return refcount;
@ -1929,7 +1928,7 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out)
*out = NULL; *out = NULL;
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFVideoPresenter_iface.lpVtbl = &video_presenter_vtbl; object->IMFVideoPresenter_iface.lpVtbl = &video_presenter_vtbl;

View File

@ -25,7 +25,6 @@
#include "dxva2api.h" #include "dxva2api.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(evr); WINE_DEFAULT_DEBUG_CHANNEL(evr);
@ -168,7 +167,7 @@ static ULONG WINAPI tracked_async_result_Release(IMFAsyncResult *iface)
IUnknown_Release(result->object); IUnknown_Release(result->object);
if (result->state) if (result->state)
IUnknown_Release(result->state); IUnknown_Release(result->state);
heap_free(result); free(result);
} }
return refcount; return refcount;
@ -250,7 +249,7 @@ static HRESULT create_async_result(IUnknown *object, IMFAsyncCallback *callback,
{ {
struct tracked_async_result *result; struct tracked_async_result *result;
result = heap_alloc_zero(sizeof(*result)); result = calloc(1, sizeof(*result));
if (!result) if (!result)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -464,13 +463,13 @@ static void sample_allocator_release_samples(struct sample_allocator *allocator)
{ {
list_remove(&iter->entry); list_remove(&iter->entry);
IMFSample_Release(iter->sample); IMFSample_Release(iter->sample);
heap_free(iter); free(iter);
} }
LIST_FOR_EACH_ENTRY_SAFE(iter, iter2, &allocator->used_samples, struct queued_sample, entry) LIST_FOR_EACH_ENTRY_SAFE(iter, iter2, &allocator->used_samples, struct queued_sample, entry)
{ {
list_remove(&iter->entry); list_remove(&iter->entry);
heap_free(iter); free(iter);
} }
} }
@ -489,7 +488,7 @@ static ULONG WINAPI sample_allocator_Release(IMFVideoSampleAllocator *iface)
IDirect3DDeviceManager9_Release(allocator->device_manager); IDirect3DDeviceManager9_Release(allocator->device_manager);
sample_allocator_release_samples(allocator); sample_allocator_release_samples(allocator);
DeleteCriticalSection(&allocator->cs); DeleteCriticalSection(&allocator->cs);
heap_free(allocator); free(allocator);
} }
return refcount; return refcount;
@ -618,7 +617,7 @@ static HRESULT sample_allocator_create_samples(struct sample_allocator *allocato
break; break;
} }
queued_sample = heap_alloc(sizeof(*queued_sample)); queued_sample = malloc(sizeof(*queued_sample));
queued_sample->sample = sample; queued_sample->sample = sample;
list_add_tail(&allocator->free_samples, &queued_sample->entry); list_add_tail(&allocator->free_samples, &queued_sample->entry);
allocator->free_sample_count++; allocator->free_sample_count++;
@ -860,7 +859,7 @@ HRESULT WINAPI MFCreateVideoSampleAllocator(REFIID riid, void **obj)
TRACE("%s, %p.\n", debugstr_guid(riid), obj); TRACE("%s, %p.\n", debugstr_guid(riid), obj);
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFVideoSampleAllocator_iface.lpVtbl = &sample_allocator_vtbl; object->IMFVideoSampleAllocator_iface.lpVtbl = &sample_allocator_vtbl;
@ -943,7 +942,7 @@ static ULONG WINAPI video_sample_Release(IMFSample *iface)
if (sample->sample) if (sample->sample)
IMFSample_Release(sample->sample); IMFSample_Release(sample->sample);
DeleteCriticalSection(&sample->cs); DeleteCriticalSection(&sample->cs);
heap_free(sample); free(sample);
} }
return refcount; return refcount;
@ -1601,7 +1600,7 @@ static ULONG WINAPI surface_buffer_Release(IMFMediaBuffer *iface)
if (!refcount) if (!refcount)
{ {
IUnknown_Release(buffer->surface); IUnknown_Release(buffer->surface);
heap_free(buffer); free(buffer);
} }
return refcount; return refcount;
@ -1704,7 +1703,7 @@ static HRESULT create_surface_buffer(IUnknown *surface, IMFMediaBuffer **buffer)
{ {
struct surface_buffer *object; struct surface_buffer *object;
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFMediaBuffer_iface.lpVtbl = &surface_buffer_vtbl; object->IMFMediaBuffer_iface.lpVtbl = &surface_buffer_vtbl;
@ -1726,7 +1725,7 @@ HRESULT WINAPI MFCreateVideoSampleFromSurface(IUnknown *surface, IMFSample **sam
TRACE("%p, %p.\n", surface, sample); TRACE("%p, %p.\n", surface, sample);
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFSample_iface.lpVtbl = &video_sample_vtbl; object->IMFSample_iface.lpVtbl = &video_sample_vtbl;
@ -1737,7 +1736,7 @@ HRESULT WINAPI MFCreateVideoSampleFromSurface(IUnknown *surface, IMFSample **sam
if (FAILED(hr = MFCreateSample(&object->sample))) if (FAILED(hr = MFCreateSample(&object->sample)))
{ {
heap_free(object); free(object);
return hr; return hr;
} }