dlls/ole32/bindctx.c: fix possible object reference count error
Rolf Kalbermatter
rolf.kalbermatter at citengineering.com
Thu Aug 28 14:59:42 CDT 2003
Changelog
- dlls/ole32/bindctx.c
Make sure the passed in object pointer is only addrefed on success
I may miss something here but believe that a function should only addref
a passed in object reference if it does use that object in some ways but
not if it fails on its supposed action somehow.
Rolf Kalbermatter
Index: dlls/ole32/bindctx.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/bindctx.c,v
retrieving revision 1.20
diff -u -r1.20 bindctx.c
--- dlls/ole32/bindctx.c 10 Apr 2003 18:17:35 -0000 1.20
+++ dlls/ole32/bindctx.c 28 Aug 2003 19:52:06 -0000
@@ -383,14 +383,13 @@
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 @@
if (!This->bindCtxTable)
return E_OUTOFMEMORY;
}
+ IUnknown_AddRef(punk);
return S_OK;
}
+
/******************************************************************************
* BindCtx_GetObjectParam
******************************************************************************/
More information about the wine-patches
mailing list