summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--spice-qemu-char.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 6f46f46b25..4d1c76e8a4 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -215,7 +215,10 @@ static void char_spice_finalize(Object *obj)
     SpiceChardev *s = SPICE_CHARDEV(obj);
 
     vmc_unregister_interface(s);
-    QLIST_REMOVE(s, next);
+
+    if (s->next.le_prev) {
+        QLIST_REMOVE(s, next);
+    }
 
     g_free((char *)s->sin.subtype);
 #if SPICE_SERVER_VERSION >= 0x000c02