[PATCH 1/7] d3d8/tests: Fix possible test failures.

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


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

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

diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index d87832b716..2b7a768f65 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -3200,6 +3200,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);
@@ -3219,6 +3220,7 @@ static void test_wndproc(void)
     flush_events();
     ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n",
             expect_messages->message, expect_messages->window);
+    expect_messages = NULL;
 
     ok(windowpos.hwnd == device_window && !windowpos.hwndInsertAfter
             && !windowpos.x && !windowpos.y && !windowpos.cx && !windowpos.cy
-- 
2.20.1




More information about the wine-devel mailing list