summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-29 09:21:40 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-29 09:21:40 +0000
commit007bfbc9e1be697a73d282111b9dcf5b5c73fa55 (patch)
treef4beb6625ae80085d23fecaa71b871e1ec2a0fe3
parentc337813d208f67e8091bf84502dc1cced767f015 (diff)
merge revision(s) 17561:
* ext/win32ole/win32ole.c(ole_invoke): fix memory leak. [ruby-bugs-20792] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@17682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ext/win32ole/win32ole.c24
-rw-r--r--version.h2
3 files changed, 26 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 6513a8f..bdde2a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Jun 29 18:21:23 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c(ole_invoke): fix memory leak.
+ [ruby-bugs-20792]
+
Sun Jun 29 17:34:11 2008 Akinori MUSHA <knu@iDaemons.org>
* eval.c (PUSH_FRAME, PUSH_CLASS): Add volatile to avoid a
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 0b7dddd..84bbe03 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.7.4"
+#define WIN32OLE_VERSION "0.7.5"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -522,6 +522,15 @@ ole_hresult2msg(hr)
return msg;
}
+static void
+ole_freeexceptinfo(pExInfo)
+ EXCEPINFO *pExInfo;
+{
+ SysFreeString(pExInfo->bstrDescription);
+ SysFreeString(pExInfo->bstrSource);
+ SysFreeString(pExInfo->bstrHelpFile);
+}
+
static VALUE
ole_excepinfo2msg(pExInfo)
EXCEPINFO *pExInfo;
@@ -561,9 +570,7 @@ ole_excepinfo2msg(pExInfo)
}
if(pSource) free(pSource);
if(pDescription) free(pDescription);
- SysFreeString(pExInfo->bstrDescription);
- SysFreeString(pExInfo->bstrSource);
- SysFreeString(pExInfo->bstrHelpFile);
+ ole_freeexceptinfo(pExInfo);
return error_msg;
}
@@ -2109,6 +2116,9 @@ ole_invoke(argc, argv, self, wFlags)
param = rb_ary_entry(paramS, i-cNamedArgs);
ole_val2variant(param, &op.dp.rgvarg[n]);
}
+ if (hr == DISP_E_EXCEPTION) {
+ ole_freeexceptinfo(&excepinfo);
+ }
memset(&excepinfo, 0, sizeof(EXCEPINFO));
VariantInit(&result);
hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID,
@@ -2121,6 +2131,9 @@ ole_invoke(argc, argv, self, wFlags)
* hResult == DISP_E_EXCEPTION. this only happens on
* functions whose DISPID > 0x8000 */
if ((hr == DISP_E_EXCEPTION || hr == DISP_E_MEMBERNOTFOUND) && DispID > 0x8000) {
+ if (hr == DISP_E_EXCEPTION) {
+ ole_freeexceptinfo(&excepinfo);
+ }
memset(&excepinfo, 0, sizeof(EXCEPINFO));
hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID,
&IID_NULL, lcid, wFlags,
@@ -2140,6 +2153,9 @@ ole_invoke(argc, argv, self, wFlags)
param = rb_ary_entry(paramS, i-cNamedArgs);
ole_val2variant2(param, &op.dp.rgvarg[n]);
}
+ if (hr == DISP_E_EXCEPTION) {
+ ole_freeexceptinfo(&excepinfo);
+ }
memset(&excepinfo, 0, sizeof(EXCEPINFO));
VariantInit(&result);
hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID,
diff --git a/version.h b/version.h
index 3a1654a..f974e71 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2008-06-29"
#define RUBY_VERSION_CODE 186
#define RUBY_RELEASE_CODE 20080629
-#define RUBY_PATCHLEVEL 246
+#define RUBY_PATCHLEVEL 247
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8