coroutine: co->fiber has not to be null
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 19 Oct 2015 04:57:24 +0000 (13:57 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 20 Oct 2015 04:02:12 +0000 (13:02 +0900)
CreateFiber() will be return NULL when it fails. If co->fiber is null,
SwitchToFiber() aborts with C0000005 and it corrupts stack that make
hard to find causes. So it is better to abort when CreateFiber()
returns NULL.

Change-Id: Ifdc36404ce523cee842fd486bdbe071e58b7d7b3
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
coroutine-win32.c

index 17ace37..8941e03 100644 (file)
@@ -75,6 +75,9 @@ Coroutine *qemu_coroutine_new(void)
 
     co = g_malloc0(sizeof(*co));
     co->fiber = CreateFiber(stack_size, coroutine_trampoline, &co->base);
+
+    g_assert(co->fiber);
+
     return &co->base;
 }