Piotr Caban : oleaut32: Set safearray pointer to NULL in LPSAFEARRAY_UserFree.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jan 14 11:10:26 CST 2016


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Jan 13 09:51:12 2016 +0100

oleaut32: Set safearray pointer to NULL in LPSAFEARRAY_UserFree.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/oleaut32/tests/usrmarshal.c | 1 +
 dlls/oleaut32/usrmarshal.c       | 1 +
 2 files changed, 2 insertions(+)

diff --git a/dlls/oleaut32/tests/usrmarshal.c b/dlls/oleaut32/tests/usrmarshal.c
index 24b382c..d4d7d53 100644
--- a/dlls/oleaut32/tests/usrmarshal.c
+++ b/dlls/oleaut32/tests/usrmarshal.c
@@ -277,6 +277,7 @@ static void test_marshal_LPSAFEARRAY(void)
     ok(lpsa2->cLocks == 0, "got lock count %u, expected 0\n", lpsa2->cLocks);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
     LPSAFEARRAY_UserFree(&umcb.Flags, &lpsa2);
+    ok(!lpsa2, "lpsa2 was not set to 0 by LPSAFEARRAY_UserFree\n");
     HeapFree(GetProcessHeap(), 0, buffer);
     lpsa->cLocks = 0;
     hr = SafeArrayDestroy(lpsa);
diff --git a/dlls/oleaut32/usrmarshal.c b/dlls/oleaut32/usrmarshal.c
index 303ec69..d66d42a 100644
--- a/dlls/oleaut32/usrmarshal.c
+++ b/dlls/oleaut32/usrmarshal.c
@@ -1091,6 +1091,7 @@ void WINAPI LPSAFEARRAY_UserFree(ULONG *pFlags, LPSAFEARRAY *ppsa)
     TRACE("("); dump_user_flags(pFlags); TRACE(", &%p\n", *ppsa);
 
     SafeArrayDestroy(*ppsa);
+    *ppsa = NULL;
 }
 
 




More information about the wine-cvs mailing list