diff options
author | Wez Furlong <wez@php.net> | 2003-05-16 19:20:18 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2003-05-16 19:20:18 +0000 |
commit | 54c83ce7a388218bd24ae0ca51fce55fad8d10b5 (patch) | |
tree | e6bb37df6c3357a595ba1851e7f1c40152607512 | |
parent | 37142b284f7422dce8fd818b25b46af76397ca36 (diff) | |
download | php-git-54c83ce7a388218bd24ae0ca51fce55fad8d10b5.tar.gz |
Fix memory leak in the COM extension.
Patch from Michael Sisolak <msisolak at yahoo dot com>
-rw-r--r-- | ext/com/COM.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/com/COM.c b/ext/com/COM.c index cdec124de4..10ae498f35 100644 --- a/ext/com/COM.c +++ b/ext/com/COM.c @@ -1627,6 +1627,11 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property, 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 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property, 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); } |