Nikolay Sivov : evr: Use CRT functions for heap allocations.

Alexandre Julliard julliard at winehq.org
Thu Apr 8 16:14:02 CDT 2021


Module: wine
Branch: master
Commit: 195f735cbeedc8a2a7621f32145f4d07bac8edda
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=195f735cbeedc8a2a7621f32145f4d07bac8edda

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Apr  8 12:18:11 2021 +0300

evr: Use CRT functions for heap allocations.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/evr/mixer.c     |  9 ++++-----
 dlls/evr/presenter.c |  7 +++----
 dlls/evr/sample.c    | 25 ++++++++++++-------------
 3 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c
index c59ec002340..03e2d166155 100644
--- a/dlls/evr/mixer.c
+++ b/dlls/evr/mixer.c
@@ -31,7 +31,6 @@
 #include "evcode.h"
 
 #include "wine/debug.h"
-#include "wine/heap.h"
 
 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);
     }
-    heap_free(mixer->output.rt_formats);
+    free(mixer->output.rt_formats);
     if (mixer->output.media_type)
         IMFMediaType_Release(mixer->output.media_type);
     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,
               &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;
                 count = 0;
@@ -703,7 +702,7 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const
         count = j + 1;
 
         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)
             {
@@ -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;
 }
diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c
index 9b7fb5f6f67..8d633124db2 100644
--- a/dlls/evr/presenter.c
+++ b/dlls/evr/presenter.c
@@ -28,7 +28,6 @@
 #include "evr_private.h"
 
 #include "wine/debug.h"
-#include "wine/heap.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(evr);
 
@@ -369,7 +368,7 @@ static void video_presenter_sample_queue_init(struct video_presenter *presenter)
         return;
 
     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->back = queue->size - 1;
 }
@@ -836,7 +835,7 @@ static ULONG WINAPI video_presenter_inner_Release(IUnknown *iface)
         }
         if (presenter->allocator)
             IMFVideoSampleAllocator_Release(presenter->allocator);
-        heap_free(presenter);
+        free(presenter);
     }
 
     return refcount;
@@ -1929,7 +1928,7 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out)
 
     *out = NULL;
 
-    if (!(object = heap_alloc_zero(sizeof(*object))))
+    if (!(object = calloc(1, sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IMFVideoPresenter_iface.lpVtbl = &video_presenter_vtbl;
diff --git a/dlls/evr/sample.c b/dlls/evr/sample.c
index 9c76011f153..cbba384e181 100644
--- a/dlls/evr/sample.c
+++ b/dlls/evr/sample.c
@@ -25,7 +25,6 @@
 #include "dxva2api.h"
 
 #include "wine/debug.h"
-#include "wine/heap.h"
 #include "wine/list.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(evr);
@@ -168,7 +167,7 @@ static ULONG WINAPI tracked_async_result_Release(IMFAsyncResult *iface)
             IUnknown_Release(result->object);
         if (result->state)
             IUnknown_Release(result->state);
-        heap_free(result);
+        free(result);
     }
 
     return refcount;
@@ -250,7 +249,7 @@ static HRESULT create_async_result(IUnknown *object, IMFAsyncCallback *callback,
 {
     struct tracked_async_result *result;
 
-    result = heap_alloc_zero(sizeof(*result));
+    result = calloc(1, sizeof(*result));
     if (!result)
         return E_OUTOFMEMORY;
 
@@ -464,13 +463,13 @@ static void sample_allocator_release_samples(struct sample_allocator *allocator)
     {
         list_remove(&iter->entry);
         IMFSample_Release(iter->sample);
-        heap_free(iter);
+        free(iter);
     }
 
     LIST_FOR_EACH_ENTRY_SAFE(iter, iter2, &allocator->used_samples, struct queued_sample, 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);
         sample_allocator_release_samples(allocator);
         DeleteCriticalSection(&allocator->cs);
-        heap_free(allocator);
+        free(allocator);
     }
 
     return refcount;
@@ -618,7 +617,7 @@ static HRESULT sample_allocator_create_samples(struct sample_allocator *allocato
             break;
         }
 
-        queued_sample = heap_alloc(sizeof(*queued_sample));
+        queued_sample = malloc(sizeof(*queued_sample));
         queued_sample->sample = sample;
         list_add_tail(&allocator->free_samples, &queued_sample->entry);
         allocator->free_sample_count++;
@@ -860,7 +859,7 @@ HRESULT WINAPI MFCreateVideoSampleAllocator(REFIID riid, void **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;
 
     object->IMFVideoSampleAllocator_iface.lpVtbl = &sample_allocator_vtbl;
@@ -943,7 +942,7 @@ static ULONG WINAPI video_sample_Release(IMFSample *iface)
         if (sample->sample)
             IMFSample_Release(sample->sample);
         DeleteCriticalSection(&sample->cs);
-        heap_free(sample);
+        free(sample);
     }
 
     return refcount;
@@ -1601,7 +1600,7 @@ static ULONG WINAPI surface_buffer_Release(IMFMediaBuffer *iface)
     if (!refcount)
     {
         IUnknown_Release(buffer->surface);
-        heap_free(buffer);
+        free(buffer);
     }
 
     return refcount;
@@ -1704,7 +1703,7 @@ static HRESULT create_surface_buffer(IUnknown *surface, IMFMediaBuffer **buffer)
 {
     struct surface_buffer *object;
 
-    if (!(object = heap_alloc_zero(sizeof(*object))))
+    if (!(object = calloc(1, sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IMFMediaBuffer_iface.lpVtbl = &surface_buffer_vtbl;
@@ -1726,7 +1725,7 @@ HRESULT WINAPI MFCreateVideoSampleFromSurface(IUnknown *surface, IMFSample **sam
 
     TRACE("%p, %p.\n", surface, sample);
 
-    if (!(object = heap_alloc_zero(sizeof(*object))))
+    if (!(object = calloc(1, sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IMFSample_iface.lpVtbl = &video_sample_vtbl;
@@ -1737,7 +1736,7 @@ HRESULT WINAPI MFCreateVideoSampleFromSurface(IUnknown *surface, IMFSample **sam
 
     if (FAILED(hr = MFCreateSample(&object->sample)))
     {
-        heap_free(object);
+        free(object);
         return hr;
     }
 




More information about the wine-cvs mailing list