summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-29 09:22:27 (GMT)
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-29 09:22:27 (GMT)
commitdef72350a9e23923dc2e4b70243d12ab057dbf00 (patch)
treea9a9fd1735a9bed0f5174906584393b4590d6a8c
parentb53240a526795688a19fd9c80b53f5e790cf2ba7 (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_7@17684 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 0688a8b..1de5184 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Jun 29 18:22:06 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c(ole_invoke): fix memory leak.
+ [ruby-bugs-20792]
+
Sun Jun 29 18:19: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 07b3ede..7844b41 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 4f29f70..aee8451 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2008-06-29"
#define RUBY_VERSION_CODE 187
#define RUBY_RELEASE_CODE 20080629
-#define RUBY_PATCHLEVEL 29
+#define RUBY_PATCHLEVEL 30
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8