cvs: php4(PHP_4_3) /ext/com COM.c
| From: | Wez Furlong | Date: | Fri, 16 May 2003 19:20:18 +0000 |
| Subject: | cvs: php4(PHP_4_3) /ext/com COM.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20969@lists.php.net to get a copy of this message | ||
wez Fri May 16 15:20:18 2003 EDT
Modified files: (Branch: PHP_4_3)
/php4/ext/com COM.c
Log:
Fix memory leak in the COM extension.
Patch from Michael Sisolak <msisolak at yahoo dot com>
Index: php4/ext/com/COM.c
diff -u php4/ext/com/COM.c:1.90.2.6 php4/ext/com/COM.c:1.90.2.7
--- php4/ext/com/COM.c:1.90.2.6 Thu Mar 27 14:56:09 2003
+++ php4/ext/com/COM.c Fri May 16 15:20:18 2003
@@ -18,7 +18,7 @@
| Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: COM.c,v 1.90.2.6 2003/03/27 19:56:09 phanto Exp $ */
+/* $Id: COM.c,v 1.90.2.7 2003/05/16 19:20:18 wez Exp $ */
/*
* This module implements support for COM components that support the IDispatch
* interface. Both local (COM) and remote (DCOM) components can be accessed.
@@ -1627,6 +1627,11 @@
FREE_VARIANT(var_result);
+ /* free the string we allocated; invoked object made its own copy */
+ if (V_VT(new_value) == VT_BSTR) {
+ VariantClear(new_value);
+ }
+
efree(new_value);
efree(propname);
@@ -1659,7 +1664,11 @@
FREE_VARIANT(var_result);
}
- efree(new_value); // FREE_VARIANT does a VariantClear() which is not desired here !
+ /* free the string we allocated; invoked object made its own copy */
+ if (V_VT(new_value) == VT_BSTR) {
+ VariantClear(new_value);
+ }
+ efree(new_value);
efree(propname);
}