Alexandre Julliard : oleaut32: Reallocate in BSTR_UserUnmarshal to avoid changing the pointer if the string didn 't change.

Alexandre Julliard julliard at winehq.org
Wed May 18 11:15:34 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed May 18 11:35:17 2011 +0200

oleaut32: Reallocate in BSTR_UserUnmarshal to avoid changing the pointer if the string didn't change.

---

 dlls/oleaut32/usrmarshal.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/oleaut32/usrmarshal.c b/dlls/oleaut32/usrmarshal.c
index b553f40..97bfef7 100644
--- a/dlls/oleaut32/usrmarshal.c
+++ b/dlls/oleaut32/usrmarshal.c
@@ -167,11 +167,12 @@ unsigned char * WINAPI BSTR_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer,
     if(header->len != header->len2)
         FIXME("len %08x != len2 %08x\n", header->len, header->len2);
 
-    SysFreeString(*pstr);
-    *pstr = NULL;
-
-    if(header->byte_len != 0xffffffff)
-        *pstr = SysAllocStringByteLen((char*)(header + 1), header->byte_len);
+    if (header->byte_len == 0xffffffff)
+    {
+        SysFreeString(*pstr);
+        *pstr = NULL;
+    }
+    else SysReAllocStringLen( pstr, (OLECHAR *)(header + 1), header->len );
 
     if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr));
     return Buffer + sizeof(*header) + sizeof(OLECHAR) * header->len;




More information about the wine-cvs mailing list