[PATCH 2/7] d3d9/tests: Fix possible test failures.

Zhiyi Zhang zzhang at codeweavers.com
Mon Mar 30 02:18:37 CDT 2020


expect_messages points to a local variable. When it goes out of scope, it
reads into random memory, causing failures.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/d3d9/tests/device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 839c030185..24e0670b61 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -4258,6 +4258,7 @@ static void test_wndproc(void)
         flush_events();
         ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n",
                 expect_messages->message, expect_messages->window, i);
+        expect_messages = NULL;
 
         /* World of Warplanes hides the window by removing WS_VISIBLE and expects Reset() to show it again. */
         device_style = GetWindowLongA(device_window, GWL_STYLE);
@@ -4277,6 +4278,7 @@ static void test_wndproc(void)
         flush_events();
         ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n",
                 expect_messages->message, expect_messages->window, i);
+        expect_messages = NULL;
 
         if (!(tests[i].create_flags & CREATE_DEVICE_NOWINDOWCHANGES))
         {
-- 
2.20.1




More information about the wine-devel mailing list