Rob Shearman : oleaut32: Introduce a new helper function, TLB_FreeCustData, for freeing custom data.
Alexandre Julliard
julliard at winehq.org
Wed Nov 28 08:01:38 CST 2007
Module: wine
Branch: master
Commit: e68371040f2d1bebbeb07aed670ffb58f5af9d50
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e68371040f2d1bebbeb07aed670ffb58f5af9d50
Author: Rob Shearman <rob at codeweavers.com>
Date: Tue Nov 27 19:16:35 2007 +0000
oleaut32: Introduce a new helper function, TLB_FreeCustData, for freeing custom data.
Fix memory leaks caused by the variable and interface custom data not
being freed properly.
---
dlls/oleaut32/typelib.c | 33 +++++++++++++++++----------------
1 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index ab5df57..ae4df69 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -1421,6 +1421,19 @@ static void *TLB_CopyTypeDesc( TYPEDESC *dest, const TYPEDESC *src, void *buffer
return buffer;
}
+/* free custom data allocated by MSFT_CustData */
+static inline void TLB_FreeCustData(TLBCustData *pCustData)
+{
+ TLBCustData *pCustDataNext;
+ for (; pCustData; pCustData = pCustDataNext)
+ {
+ VariantClear(&pCustData->data);
+
+ pCustDataNext = pCustData->next;
+ TLB_Free(pCustData);
+ }
+}
+
/**********************************************************************
*
* Functions for reading MSFT typelibs (those created by CreateTypeLib2)
@@ -4474,7 +4487,6 @@ static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
TLBFuncDesc *pFInfo, *pFInfoNext;
TLBVarDesc *pVInfo, *pVInfoNext;
TLBImplType *pImpl, *pImplNext;
- TLBCustData *pCustData, *pCustDataNext;
TRACE("destroying ITypeInfo(%p)\n",This);
@@ -4514,13 +4526,7 @@ static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
}
TLB_Free(pFInfo->funcdesc.lprgelemdescParam);
TLB_Free(pFInfo->pParamDesc);
- for (pCustData = pFInfo->pCustData; pCustData; pCustData = pCustDataNext)
- {
- VariantClear(&pCustData->data);
-
- pCustDataNext = pCustData->next;
- TLB_Free(pCustData);
- }
+ TLB_FreeCustData(pFInfo->pCustData);
if (HIWORD(pFInfo->Entry) != 0 && pFInfo->Entry != (BSTR)-1)
SysFreeString(pFInfo->Entry);
SysFreeString(pFInfo->HelpString);
@@ -4536,23 +4542,18 @@ static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
VariantClear(pVInfo->vardesc.u.lpvarValue);
TLB_Free(pVInfo->vardesc.u.lpvarValue);
}
+ TLB_FreeCustData(pVInfo->pCustData);
SysFreeString(pVInfo->Name);
pVInfoNext = pVInfo->next;
TLB_Free(pVInfo);
}
for(pImpl = This->impltypelist; pImpl; pImpl = pImplNext)
{
- for (pCustData = pImpl->pCustData; pCustData; pCustData = pCustDataNext)
- {
- VariantClear(&pCustData->data);
-
- pCustDataNext = pCustData->next;
- TLB_Free(pCustData);
- }
+ TLB_FreeCustData(pImpl->pCustData);
pImplNext = pImpl->next;
TLB_Free(pImpl);
}
- TLB_Free(This->pCustData);
+ TLB_FreeCustData(This->pCustData);
finish_free:
if (This->next)
More information about the wine-cvs
mailing list