msxml3: Do not leak bind context on error paths (Coverity).

This commit is contained in:
Alistair Leslie-Hughes 2023-10-11 17:55:04 +11:00 committed by Alexandre Julliard
parent 2e23904abc
commit 48cebe2b91

View file

@ -680,19 +680,12 @@ static const IAuthenticateVtbl AuthenticateVtbl = {
static HRESULT BindStatusCallback_create(httprequest* This, BindStatusCallback **obj, const VARIANT *body)
{
BindStatusCallback *bsc;
IBindCtx *pbc;
IBindCtx *pbc = NULL;
HRESULT hr;
LONG size;
hr = CreateBindCtx(0, &pbc);
if (hr != S_OK) return hr;
bsc = heap_alloc(sizeof(*bsc));
if (!bsc)
{
IBindCtx_Release(pbc);
if (!(bsc = heap_alloc(sizeof(*bsc))))
return E_OUTOFMEMORY;
}
bsc->IBindStatusCallback_iface.lpVtbl = &BindStatusCallbackVtbl;
bsc->IHttpNegotiate_iface.lpVtbl = &BSCHttpNegotiateVtbl;
@ -795,7 +788,9 @@ static HRESULT BindStatusCallback_create(httprequest* This, BindStatusCallback *
SafeArrayUnaccessData(sa);
}
hr = RegisterBindStatusCallback(pbc, &bsc->IBindStatusCallback_iface, NULL, 0);
hr = CreateBindCtx(0, &pbc);
if (hr == S_OK)
hr = RegisterBindStatusCallback(pbc, &bsc->IBindStatusCallback_iface, NULL, 0);
if (hr == S_OK)
{
IMoniker *moniker;
@ -809,9 +804,11 @@ static HRESULT BindStatusCallback_create(httprequest* This, BindStatusCallback *
IMoniker_Release(moniker);
if (stream) IStream_Release(stream);
}
IBindCtx_Release(pbc);
}
if (pbc)
IBindCtx_Release(pbc);
if (FAILED(hr))
{
IBindStatusCallback_Release(&bsc->IBindStatusCallback_iface);