winegstreamer: return the IMemAllocator so the BaseOutputPin can store it and use it, avoiding a NULL pointer crash.

This commit is contained in:
Damjan Jovanovic 2013-01-17 07:38:12 +02:00 committed by Alexandre Julliard
parent 3a4281708a
commit 4bdfa7f864
1 changed files with 9 additions and 0 deletions

View File

@ -1478,6 +1478,8 @@ static ULONG WINAPI GSTOutPin_Release(IPin *iface) {
DeleteMediaType(This->pmt); DeleteMediaType(This->pmt);
FreeMediaType(&This->pin.pin.mtCurrent); FreeMediaType(&This->pin.pin.mtCurrent);
gst_segment_free(This->segment); gst_segment_free(This->segment);
if (This->pin.pAllocator)
IMemAllocator_Release(This->pin.pAllocator);
CoTaskMemFree(This); CoTaskMemFree(This);
return 0; return 0;
} }
@ -1510,7 +1512,14 @@ static HRESULT WINAPI GSTOutPin_DecideAllocator(BaseOutputPin *iface, IMemInputP
*pAlloc = NULL; *pAlloc = NULL;
if (GSTfilter->pInputPin.pAlloc) if (GSTfilter->pInputPin.pAlloc)
{
hr = IMemInputPin_NotifyAllocator(pPin, GSTfilter->pInputPin.pAlloc, FALSE); hr = IMemInputPin_NotifyAllocator(pPin, GSTfilter->pInputPin.pAlloc, FALSE);
if (SUCCEEDED(hr))
{
*pAlloc = GSTfilter->pInputPin.pAlloc;
IMemAllocator_AddRef(*pAlloc);
}
}
else else
hr = VFW_E_NO_ALLOCATOR; hr = VFW_E_NO_ALLOCATOR;