forked from Mirrors/wine-wine
Make sure the passed in object pointer is only addrefed on success.
parent
2385079814
commit
919bd7855f
|
@ -383,14 +383,13 @@ HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey,
|
||||||
if (punk==NULL)
|
if (punk==NULL)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
IUnknown_AddRef(punk);
|
|
||||||
|
|
||||||
if (pszkey!=NULL && BindCtxImpl_GetObjectIndex(This,NULL,pszkey,&index)==S_OK)
|
if (pszkey!=NULL && BindCtxImpl_GetObjectIndex(This,NULL,pszkey,&index)==S_OK)
|
||||||
{
|
{
|
||||||
TRACE("Overwriting existing key\n");
|
TRACE("Overwriting existing key\n");
|
||||||
if(This->bindCtxTable[index].pObj!=NULL)
|
if(This->bindCtxTable[index].pObj!=NULL)
|
||||||
IUnknown_Release(This->bindCtxTable[index].pObj);
|
IUnknown_Release(This->bindCtxTable[index].pObj);
|
||||||
This->bindCtxTable[index].pObj=punk;
|
This->bindCtxTable[index].pObj=punk;
|
||||||
|
IUnknown_AddRef(punk);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
This->bindCtxTable[This->bindCtxTableLastIndex].pObj = punk;
|
This->bindCtxTable[This->bindCtxTableLastIndex].pObj = punk;
|
||||||
|
@ -425,8 +424,10 @@ HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey,
|
||||||
if (!This->bindCtxTable)
|
if (!This->bindCtxTable)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
IUnknown_AddRef(punk);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* BindCtx_GetObjectParam
|
* BindCtx_GetObjectParam
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue