aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test-coroutine.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test-coroutine.c b/tests/test-coroutine.c
index ee5e06d327..6431dd6d7c 100644
--- a/tests/test-coroutine.c
+++ b/tests/test-coroutine.c
@@ -139,13 +139,20 @@ static void test_co_queue(void)
{
Coroutine *c1;
Coroutine *c2;
+ Coroutine tmp;
c2 = qemu_coroutine_create(c2_fn, NULL);
c1 = qemu_coroutine_create(c1_fn, c2);
qemu_coroutine_enter(c1);
+
+ /* c1 shouldn't be used any more now; make sure we segfault if it is */
+ tmp = *c1;
memset(c1, 0xff, sizeof(Coroutine));
qemu_coroutine_enter(c2);
+
+ /* Must restore the coroutine now to avoid corrupted pool */
+ *c1 = tmp;
}
/*