From d2907d42bea13a670d5fb52c32e8761fa57efff1 Mon Sep 17 00:00:00 2001 From: suke Date: Sat, 13 Jan 2007 14:40:54 +0000 Subject: fix memory leak of win32ole. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/win32ole/win32ole.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index 053bb2f813..9d29e9183e 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -79,7 +79,7 @@ #define WC2VSTR(x) ole_wc2vstr((x), TRUE) -#define WIN32OLE_VERSION "0.8.2" +#define WIN32OLE_VERSION "0.8.3" typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX) (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*); @@ -619,12 +619,14 @@ static void ole_free(struct oledata *pole) { OLE_FREE(pole->pDispatch); + free(pole); } static void oletype_free(struct oletypedata *poletype) { OLE_FREE(poletype->pTypeInfo); + free(poletype); } static void @@ -632,18 +634,21 @@ olemethod_free(struct olemethoddata *polemethod) { OLE_FREE(polemethod->pTypeInfo); OLE_FREE(polemethod->pOwnerTypeInfo); + free(polemethod); } static void olevariable_free(struct olevariabledata *polevar) { OLE_FREE(polevar->pTypeInfo); + free(polevar); } static void oleparam_free(struct oleparamdata *pole) { OLE_FREE(pole->pTypeInfo); + free(pole); } static LPWSTR @@ -6604,7 +6609,12 @@ ole_event_free(struct oleeventdata *poleev) IConnectionPoint *pcp = NULL; if (poleev->freed == 1) { - return; + /* + * this return create memory leak. + * but poleev->pEvent->pConnectionPoint shoul'd not be freed + * until poleev-> freed == 0. + */ + return; } if(poleev->pEvent) { pti = poleev->pEvent->pTypeInfo; @@ -6614,6 +6624,7 @@ ole_event_free(struct oleeventdata *poleev) pcp->lpVtbl->Unadvise(pcp, poleev->pEvent->m_dwCookie); OLE_RELEASE(pcp); } + free(poleev); } } -- cgit v1.2.3