By copying the next entry to a tmp pointer,
qemu_del_vm_change_state_handler() can be called in the handler.

Signed-off-by: Yoshiaki Tamura <tamura.yoshi...@lab.ntt.co.jp>
---
 vl.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/vl.c b/vl.c
index 805e11f..6b6aec0 100644
--- a/vl.c
+++ b/vl.c
@@ -1073,11 +1073,12 @@ void 
qemu_del_vm_change_state_handler(VMChangeStateEntry *e)
 
 void vm_state_notify(int running, int reason)
 {
-    VMChangeStateEntry *e;
+    VMChangeStateEntry *e, *ne;
 
     trace_vm_state_notify(running, reason);
 
-    for (e = vm_change_state_head.lh_first; e; e = e->entries.le_next) {
+    for (e = vm_change_state_head.lh_first; e; e = ne) {
+        ne = e->entries.le_next;
         e->cb(e->opaque, running, reason);
     }
 }
-- 
1.7.1.2

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to