diff options
author | suke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-01-13 14:40:54 +0000 |
---|---|---|
committer | suke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-01-13 14:40:54 +0000 |
commit | d2907d42bea13a670d5fb52c32e8761fa57efff1 (patch) | |
tree | 9785b5bee993b152e701490f70ca6ddc8e2df750 /ext/win32ole | |
parent | 77619b3a566441daea5e9e50e1b82e9c002d25d3 (diff) | |
download | ruby-d2907d42bea13a670d5fb52c32e8761fa57efff1.tar.gz |
fix memory leak of win32ole.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/win32ole')
-rw-r--r-- | ext/win32ole/win32ole.c | 15 |
1 files changed, 13 insertions, 2 deletions
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); } } |