From 6905b93447a42e606dfd126b90f75f4cd3c6fe94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 6 Apr 2017 14:05:11 +0200 Subject: console: add same surface replace pre-condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Catch an invalid state early, before a potential use-after-free. This is mainly useful for documentation purposes. Signed-off-by: Marc-André Lureau Message-id: 20170406120513.638-2-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann --- ui/console.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ui') diff --git a/ui/console.c b/ui/console.c index 419b098..0cbe503 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1538,6 +1538,8 @@ void dpy_gfx_replace_surface(QemuConsole *con, DisplaySurface *old_surface = con->surface; DisplayChangeListener *dcl; + assert(old_surface != surface); + con->surface = surface; QLIST_FOREACH(dcl, &s->listeners, next) { if (con != (dcl->con ? dcl->con : active_console)) { -- cgit v1.1