From 48cebe2b91c5fd9c1c9202be4779ba831efeb02c Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 11 Oct 2023 17:55:04 +1100 Subject: [PATCH] msxml3: Do not leak bind context on error paths (Coverity). --- dlls/msxml3/httprequest.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c index 459466a1234..e21ece7d9c4 100644 --- a/dlls/msxml3/httprequest.c +++ b/dlls/msxml3/httprequest.c @@ -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); -- 2.11.4.GIT