Rob Shearman : msxml3: Fix double-free of BSTR in domdoc tests.

Alexandre Julliard julliard at winehq.org
Wed Dec 2 10:22:14 CST 2009


Module: wine
Branch: master
Commit: 211e4fc0fe0c52236631576da1e187e2bdf32ba5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=211e4fc0fe0c52236631576da1e187e2bdf32ba5

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Wed Dec  2 14:21:54 2009 +0000

msxml3: Fix double-free of BSTR in domdoc tests.

Using the _bstr_ allocator adds the returned string to a cache, so the
string shouldn't be freed with SysFreeString. Therefore, just replace
the lone call to _bstr_ in this function by a straight call to
SysAllocString.

---

 dlls/msxml3/tests/domdoc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index a5b207a..de78b65 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -209,6 +209,9 @@ static const CHAR szBasicTransformOutput[] =
 static const WCHAR szNonExistentFile[] = {
     'c', ':', '\\', 'N', 'o', 'n', 'e', 'x', 'i', 's', 't', 'e', 'n', 't', '.', 'x', 'm', 'l', 0
 };
+static const WCHAR szNonExistentAttribute[] = {
+    'n','o','n','E','x','i','s','i','t','i','n','g','A','t','t','r','i','b','u','t','e',0
+};
 static const WCHAR szDocument[] = {
     '#', 'd', 'o', 'c', 'u', 'm', 'e', 'n', 't', 0
 };
@@ -1110,7 +1113,7 @@ static void test_domnode( void )
         SysFreeString( str );
 
         attr = (IXMLDOMAttribute*)0xdeadbeef;
-        str = _bstr_("nonExisitingAttribute");
+        str = SysAllocString( szNonExistentAttribute );
         r = IXMLDOMElement_getAttributeNode( element, str, &attr);
         ok( r == S_FALSE, "getAttributeNode ret %08x\n", r );
         ok( attr == NULL, "getAttributeNode ret %p, expected NULL\n", attr );




More information about the wine-cvs mailing list