In 'qemu_chr_open_spice_vmc' if the 'psubtype' is NULL, it will
call 'char_spice_finalize'. But as the SpiceChardev is not inserted
in the 'spice_chars' list, the 'QLIST_REMOVE' will cause a segfault.
Add a detect to avoid it.
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Message-Id: <
1487665107-88004-1-git-send-email-liqiang6-s@360.cn>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Li Qiang <liq3ea@gmail.com>
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