A display listener's dpy_refresh callback could potentially unregister itself from the listener list, which would invalidate the iteration pointer. Switch to QLIST_FOREACH_SAFE to allow safe removal during traversal.
Reported-by: Pavee Hui <[email protected]> Signed-off-by: Marc-André Lureau <[email protected]> --- ui/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/console.c b/ui/console.c index 795c9857de82..b7357172007e 100644 --- a/ui/console.c +++ b/ui/console.c @@ -828,9 +828,9 @@ bool qemu_console_check_format(QemuConsole *con, static void dpy_refresh(DisplayState *s) { - DisplayChangeListener *dcl; + DisplayChangeListener *dcl, *next_dcl; - QLIST_FOREACH(dcl, &s->listeners, next) { + QLIST_FOREACH_SAFE(dcl, &s->listeners, next, next_dcl) { if (dcl->ops->dpy_refresh) { dcl->ops->dpy_refresh(dcl); } -- 2.56.0.rc0.29.g47ce80527c56
