On 8/28/20 11:48 PM, Derek Lesho wrote:
@@ -178,15 +187,27 @@ static const IMFMediaSourceVtbl IMFMediaSource_vtbl = static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_source **out_media_source) { struct media_source *object = heap_alloc_zero(sizeof(*object));
HRESULT hr;
if (!object) return E_OUTOFMEMORY;
if (FAILED(hr = MFCreateEventQueue(&object->event_queue)))
goto fail;
object->IMFMediaSource_iface.lpVtbl = &IMFMediaSource_vtbl; object->ref = 1;
*out_media_source = object; return S_OK;
fail:
WARN("Failed to construct MFMediaSource, hr %#x.\n", hr);
if (object->event_queue)
IMFMediaEventQueue_Release(object->event_queue);
heap_free(object);
return hr;
}
Might be easier to do a regular Release() on failure.
On source release you should release the queue, and probably shutdown too just in case.