Commit 919bd785 authored by Rolf Kalbermatter's avatar Rolf Kalbermatter Committed by Alexandre Julliard

Make sure the passed in object pointer is only addrefed on success.

parent 23850798
......@@ -383,14 +383,13 @@ HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey,
if (punk==NULL)
return E_INVALIDARG;
IUnknown_AddRef(punk);
if (pszkey!=NULL && BindCtxImpl_GetObjectIndex(This,NULL,pszkey,&index)==S_OK)
{
TRACE("Overwriting existing key\n");
if(This->bindCtxTable[index].pObj!=NULL)
IUnknown_Release(This->bindCtxTable[index].pObj);
This->bindCtxTable[index].pObj=punk;
IUnknown_AddRef(punk);
return S_OK;
}
This->bindCtxTable[This->bindCtxTableLastIndex].pObj = punk;
......@@ -425,8 +424,10 @@ HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey,
if (!This->bindCtxTable)
return E_OUTOFMEMORY;
}
IUnknown_AddRef(punk);
return S_OK;
}
/******************************************************************************
* BindCtx_GetObjectParam
******************************************************************************/
......
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