Module: wine Branch: master Commit: 2764d3e3bad2741e4febc0fb8b51e2a0d978e923 URL: https://source.winehq.org/git/wine.git/?a=commit;h=2764d3e3bad2741e4febc0fb8... Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Apr 19 16:03:09 2021 +0300 evr/presenter: Add missing allocation error path. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/evr/presenter.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c index cbf799b61a1..414ba5bcaa0 100644 --- a/dlls/evr/presenter.c +++ b/dlls/evr/presenter.c @@ -391,17 +391,21 @@ static HRESULT video_presenter_invalidate_media_type(struct video_presenter *pre return hr; } -static void video_presenter_sample_queue_init(struct video_presenter *presenter) +static HRESULT video_presenter_sample_queue_init(struct video_presenter *presenter) { struct sample_queue *queue = &presenter->thread.queue; if (queue->size) - return; + return S_OK; memset(queue, 0, sizeof(*queue)); - queue->samples = calloc(presenter->allocator_capacity, sizeof(*queue->samples)); + if (!(queue->samples = calloc(presenter->allocator_capacity, sizeof(*queue->samples)))) + return E_OUTOFMEMORY; + queue->size = presenter->allocator_capacity; queue->back = queue->size - 1; + + return S_OK; } static void video_presenter_sample_queue_push(struct video_presenter *presenter, IMFSample *sample) @@ -714,10 +718,13 @@ static DWORD CALLBACK video_presenter_streaming_thread(void *arg) static HRESULT video_presenter_start_streaming(struct video_presenter *presenter) { + HRESULT hr; + if (presenter->thread.hthread) return S_OK; - video_presenter_sample_queue_init(presenter); + if (FAILED(hr = video_presenter_sample_queue_init(presenter))) + return hr; if (!(presenter->thread.ready_event = CreateEventW(NULL, FALSE, FALSE, NULL))) return HRESULT_FROM_WIN32(GetLastError());