From 791bc1cb93a2b17af2ef969df30b19bf5cec3afc Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 2 Sep 2012 14:57:15 +0200 Subject: [PATCH] quartz: Handle freeing pins in error case (Coverity). --- dlls/quartz/filtergraph.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 1cc1df988cf..239cf0bbd24 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -906,12 +906,13 @@ static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *ppinOut, IEnumPins* penumpins; IEnumMoniker* pEnumMoniker; GUID tab[2]; - ULONG nb; + ULONG nb = 0; IMoniker* pMoniker; ULONG pin; PIN_INFO PinInfo; CLSID FilterCLSID; PIN_DIRECTION dir; + unsigned int i = 0; TRACE("(%p/%p)->(%p, %p)\n", This, iface, ppinOut, ppinIn); @@ -1012,7 +1013,7 @@ static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *ppinOut, { VARIANT var; GUID clsid; - IPin** ppins; + IPin** ppins = NULL; IPin* ppinfilter = NULL; IBaseFilter* pfilter = NULL; IAMGraphBuilderCallback *callback = NULL; @@ -1104,7 +1105,6 @@ static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *ppinOut, hr = GetInternalConnections(pfilter, ppinfilter, &ppins, &nb); if (SUCCEEDED(hr)) { - unsigned int i; if (nb == 0) { IPin_Disconnect(ppinfilter); IPin_Disconnect(ppinOut); @@ -1157,6 +1157,8 @@ error: IFilterGraph2_RemoveFilter(iface, pfilter); IBaseFilter_Release(pfilter); } + while (++i < nb) IPin_Release(ppins[i]); + CoTaskMemFree(ppins); } out: