Nikolay Sivov : evr/allocator: Fix released sample pointer check.
Alexandre Julliard
julliard at winehq.org
Thu Nov 12 15:17:45 CST 2020
Module: wine
Branch: master
Commit: 2ef767dcee599d3ca74495d2b825e720ef9dcd96
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2ef767dcee599d3ca74495d2b825e720ef9dcd96
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu Nov 12 13:36:35 2020 +0300
evr/allocator: Fix released sample pointer check.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/evr/sample.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/evr/sample.c b/dlls/evr/sample.c
index a44e3ef45c6..e84d7450c7f 100644
--- a/dlls/evr/sample.c
+++ b/dlls/evr/sample.c
@@ -796,15 +796,23 @@ static HRESULT WINAPI sample_allocator_tracking_callback_Invoke(IMFAsyncCallback
{
struct sample_allocator *allocator = impl_from_IMFAsyncCallback(iface);
struct queued_sample *iter;
- IUnknown *sample = NULL;
+ IUnknown *object = NULL;
+ IMFSample *sample = NULL;
+ HRESULT hr;
- EnterCriticalSection(&allocator->cs);
+ if (FAILED(IMFAsyncResult_GetObject(result, &object)))
+ return E_UNEXPECTED;
- IMFAsyncResult_GetObject(result, (IUnknown **)&sample);
+ hr = IUnknown_QueryInterface(object, &IID_IMFSample, (void **)&sample);
+ IUnknown_Release(object);
+ if (FAILED(hr))
+ return E_UNEXPECTED;
+
+ EnterCriticalSection(&allocator->cs);
LIST_FOR_EACH_ENTRY(iter, &allocator->used_samples, struct queued_sample, entry)
{
- if (sample == (IUnknown *)iter->sample)
+ if (sample == iter->sample)
{
list_remove(&iter->entry);
list_add_tail(&allocator->free_samples, &iter->entry);
@@ -813,7 +821,7 @@ static HRESULT WINAPI sample_allocator_tracking_callback_Invoke(IMFAsyncCallback
}
}
- IUnknown_Release(sample);
+ IMFSample_Release(sample);
if (allocator->callback)
IMFVideoSampleAllocatorNotify_NotifyRelease(allocator->callback);
More information about the wine-cvs
mailing list