Commit 6eefb9d3 authored by Chris Robinson's avatar Chris Robinson Committed by Alexandre Julliard

quartz: Release objects when they're no longer needed.

parent 54f4a4a7
...@@ -430,7 +430,7 @@ static HRESULT WINAPI GraphBuilder_RemoveFilter(IGraphBuilder *iface, ...@@ -430,7 +430,7 @@ static HRESULT WINAPI GraphBuilder_RemoveFilter(IGraphBuilder *iface,
hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, This->pFilterNames[i]); hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, This->pFilterNames[i]);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
IPin_Release(pFilter); IBaseFilter_Release(pFilter);
CoTaskMemFree(This->pFilterNames[i]); CoTaskMemFree(This->pFilterNames[i]);
memmove(This->ppFiltersInGraph+i, This->ppFiltersInGraph+i+1, sizeof(IBaseFilter*)*(This->nFilters - 1 - i)); memmove(This->ppFiltersInGraph+i, This->ppFiltersInGraph+i+1, sizeof(IBaseFilter*)*(This->nFilters - 1 - i));
memmove(This->pFilterNames+i, This->pFilterNames+i+1, sizeof(LPWSTR)*(This->nFilters - 1 - i)); memmove(This->pFilterNames+i, This->pFilterNames+i+1, sizeof(LPWSTR)*(This->nFilters - 1 - i));
...@@ -650,12 +650,12 @@ static HRESULT GetInternalConnections(IBaseFilter* pfilter, IPin* pinputpin, IPi ...@@ -650,12 +650,12 @@ static HRESULT GetInternalConnections(IBaseFilter* pfilter, IPin* pinputpin, IPi
else else
IPin_Release(ppin); IPin_Release(ppin);
} }
IEnumPins_Release(penumpins);
nb = i; nb = i;
if (FAILED(hr)) { if (FAILED(hr)) {
ERR("Next failed (%x)\n", hr); ERR("Next failed (%x)\n", hr);
return hr; return hr;
} }
IEnumPins_Release(penumpins);
} else if (FAILED(hr)) { } else if (FAILED(hr)) {
ERR("Cannot get internal connection (%x)\n", hr); ERR("Cannot get internal connection (%x)\n", hr);
return hr; return hr;
...@@ -714,11 +714,10 @@ static HRESULT WINAPI GraphBuilder_Connect(IGraphBuilder *iface, ...@@ -714,11 +714,10 @@ static HRESULT WINAPI GraphBuilder_Connect(IGraphBuilder *iface,
return hr; return hr;
hr = IBaseFilter_GetClassID(PinInfo.pFilter, &FilterCLSID); hr = IBaseFilter_GetClassID(PinInfo.pFilter, &FilterCLSID);
IBaseFilter_Release(PinInfo.pFilter);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
IBaseFilter_Release(PinInfo.pFilter);
/* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream /* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream
* filter to the minor mediatype of input pin of the renderer */ * filter to the minor mediatype of input pin of the renderer */
hr = IPin_EnumMediaTypes(ppinOut, &penummt); hr = IPin_EnumMediaTypes(ppinOut, &penummt);
...@@ -830,6 +829,7 @@ static HRESULT WINAPI GraphBuilder_Connect(IGraphBuilder *iface, ...@@ -830,6 +829,7 @@ static HRESULT WINAPI GraphBuilder_Connect(IGraphBuilder *iface,
while (++i < nb) IPin_Release(ppins[i]); while (++i < nb) IPin_Release(ppins[i]);
CoTaskMemFree(ppins); CoTaskMemFree(ppins);
IPin_Release(ppinfilter); IPin_Release(ppinfilter);
IBaseFilter_Release(pfilter);
break; break;
} }
...@@ -926,6 +926,7 @@ static HRESULT WINAPI GraphBuilder_Render(IGraphBuilder *iface, ...@@ -926,6 +926,7 @@ static HRESULT WINAPI GraphBuilder_Render(IGraphBuilder *iface,
hr = IGraphBuilder_AddFilter(iface, pfilter, NULL); hr = IGraphBuilder_AddFilter(iface, pfilter, NULL);
if (FAILED(hr)) { if (FAILED(hr)) {
ERR("Unable to add filter (%x)\n", hr); ERR("Unable to add filter (%x)\n", hr);
IBaseFilter_Release(pfilter);
pfilter = NULL; pfilter = NULL;
goto error; goto error;
} }
...@@ -936,6 +937,7 @@ static HRESULT WINAPI GraphBuilder_Render(IGraphBuilder *iface, ...@@ -936,6 +937,7 @@ static HRESULT WINAPI GraphBuilder_Render(IGraphBuilder *iface,
goto error; goto error;
} }
hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin); hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin);
IEnumPins_Release(penumpins);
if (FAILED(hr)) { if (FAILED(hr)) {
ERR("Next (%x)\n", hr); ERR("Next (%x)\n", hr);
goto error; goto error;
...@@ -944,14 +946,17 @@ static HRESULT WINAPI GraphBuilder_Render(IGraphBuilder *iface, ...@@ -944,14 +946,17 @@ static HRESULT WINAPI GraphBuilder_Render(IGraphBuilder *iface,
ERR("No Pin\n"); ERR("No Pin\n");
goto error; goto error;
} }
IEnumPins_Release(penumpins);
/* Connect the pin to render to the renderer */ /* Connect the pin to render to the renderer */
hr = IGraphBuilder_Connect(iface, ppinOut, ppinfilter); hr = IGraphBuilder_Connect(iface, ppinOut, ppinfilter);
if (FAILED(hr)) { if (FAILED(hr)) {
TRACE("Unable to connect to renderer (%x)\n", hr); TRACE("Unable to connect to renderer (%x)\n", hr);
IPin_Release(ppinfilter);
goto error; goto error;
} }
IPin_Release(ppinfilter);
IBaseFilter_Release(pfilter);
pfilter = NULL;
break; break;
error: error:
...@@ -977,7 +982,7 @@ static HRESULT WINAPI GraphBuilder_RenderFile(IGraphBuilder *iface, ...@@ -977,7 +982,7 @@ static HRESULT WINAPI GraphBuilder_RenderFile(IGraphBuilder *iface,
static const WCHAR string[] = {'R','e','a','d','e','r',0}; static const WCHAR string[] = {'R','e','a','d','e','r',0};
IBaseFilter* preader = NULL; IBaseFilter* preader = NULL;
IBaseFilter* psplitter = NULL; IBaseFilter* psplitter = NULL;
IPin* ppinreader; IPin* ppinreader = NULL;
IPin* ppinsplitter; IPin* ppinsplitter;
IEnumPins* penumpins; IEnumPins* penumpins;
ULONG pin; ULONG pin;
...@@ -1021,6 +1026,8 @@ static HRESULT WINAPI GraphBuilder_RenderFile(IGraphBuilder *iface, ...@@ -1021,6 +1026,8 @@ static HRESULT WINAPI GraphBuilder_RenderFile(IGraphBuilder *iface,
if (FAILED(hr)) if (FAILED(hr))
{ {
if (ppinreader)
IPin_Release(ppinreader);
if (pEnumMoniker) if (pEnumMoniker)
IEnumMoniker_Release(pEnumMoniker); IEnumMoniker_Release(pEnumMoniker);
if (preader) { if (preader) {
...@@ -1079,7 +1086,8 @@ static HRESULT WINAPI GraphBuilder_RenderFile(IGraphBuilder *iface, ...@@ -1079,7 +1086,8 @@ static HRESULT WINAPI GraphBuilder_RenderFile(IGraphBuilder *iface,
} }
} }
IPin_Release(ppinsplitter); if (ppinsplitter)
IPin_Release(ppinsplitter);
ppinsplitter = NULL; ppinsplitter = NULL;
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
...@@ -1117,6 +1125,11 @@ static HRESULT WINAPI GraphBuilder_RenderFile(IGraphBuilder *iface, ...@@ -1117,6 +1125,11 @@ static HRESULT WINAPI GraphBuilder_RenderFile(IGraphBuilder *iface,
hr = (partial ? VFW_S_PARTIAL_RENDER : S_OK); hr = (partial ? VFW_S_PARTIAL_RENDER : S_OK);
} }
IPin_Release(ppinreader);
IBaseFilter_Release(preader);
if (psplitter);
IBaseFilter_Release(psplitter);
return hr; return hr;
} }
...@@ -1171,6 +1184,7 @@ static HRESULT WINAPI GraphBuilder_AddSourceFilter(IGraphBuilder *iface, ...@@ -1171,6 +1184,7 @@ static HRESULT WINAPI GraphBuilder_AddSourceFilter(IGraphBuilder *iface,
if (ppFilter) if (ppFilter)
*ppFilter = preader; *ppFilter = preader;
IFileSourceFilter_Release(pfile);
return S_OK; return S_OK;
...@@ -1326,10 +1340,12 @@ static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundF ...@@ -1326,10 +1340,12 @@ static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundF
hr = IPin_ConnectedTo(pOutputPin, &pInputPin); hr = IPin_ConnectedTo(pOutputPin, &pInputPin);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{
hr = IPin_QueryPinInfo(pInputPin, &PinInfo); hr = IPin_QueryPinInfo(pInputPin, &PinInfo);
if (SUCCEEDED(hr))
if (SUCCEEDED(hr)) hr = GetInternalConnections(PinInfo.pFilter, pInputPin, &ppPins, &nb);
hr = GetInternalConnections(PinInfo.pFilter, pInputPin, &ppPins, &nb); IPin_Release(pInputPin);
}
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment