OSDN Git Service

test-coroutine: Fix coroutine pool corruption
authorKevin Wolf <kwolf@redhat.com>
Wed, 10 Aug 2016 11:06:55 +0000 (13:06 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 5 Sep 2016 17:06:48 +0000 (19:06 +0200)
commit980e66216ffc3e37903f979e02c5f63152b518c3
tree4543128dd0072611dc5c92d911ab553a279c0524
parent00198ecc776d2d6b9f65703f209f4e2c8b2ab844
test-coroutine: Fix coroutine pool corruption

The test case overwrites the Coroutine object with 0xff as a way to
assert that the coroutine isn't used any more. However, this means that
the coroutine pool now contains a corrupted object and later test cases
may get this corrupted object and crash.

This patch saves the real content of the object and restores it after
completing the test. The only use of the coroutine pool between those
two points is the deletion of co2. As this only means an insertion at
the head of an SLIST (release_pool or alloc_pool), it doesn't access the
invalid list pointers that co1 has during this period.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
tests/test-coroutine.c