From: Marc-André Lureau <[email protected]>
vt100_fini() is called unconditonally from qemu_text_console_finalize(),
but it may not have been vt100_init()/opened: fix the crash in that case.
Fixes: 8fa294482eb ("ui/console-vc: move VT100 state machine ...")
Signed-off-by: Marc-André Lureau <[email protected]>
---
ui/vt100.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ui/vt100.c b/ui/vt100.c
index f8140cfa85c..6e64845b6c0 100644
--- a/ui/vt100.c
+++ b/ui/vt100.c
@@ -978,6 +978,9 @@ void vt100_init(QemuVT100 *vt,
void vt100_fini(QemuVT100 *vt)
{
+ if (!QTAILQ_IN_USE(vt, list)) {
+ return;
+ }
QTAILQ_REMOVE(&vt100s, vt, list);
fifo8_destroy(&vt->out_fifo);
g_free(vt->cells);
--
2.54.0