[Spice-devel] [PATCH v2 01/12] spice: init dcl before registering qxl interface

Gerd Hoffmann kraxel at redhat.com
Fri Feb 19 09:14:38 UTC 2016


Without this spice might callback into qemu before ssd->dcl.con is
initialized, resulting in a segfault due to NULL pointer dereference.

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 ui/spice-display.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ui/spice-display.c b/ui/spice-display.c
index 8a5b325..cdbc78d 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -775,14 +775,14 @@ static void qemu_spice_display_init_one(QemuConsole *con)
 
     qemu_spice_display_init_common(ssd);
 
+    ssd->dcl.ops = &display_listener_ops;
+    ssd->dcl.con = con;
+
     ssd->qxl.base.sif = &dpy_interface.base;
     qemu_spice_add_display_interface(&ssd->qxl, con);
     assert(ssd->worker);
-
     qemu_spice_create_host_memslot(ssd);
 
-    ssd->dcl.ops = &display_listener_ops;
-    ssd->dcl.con = con;
     register_displaychangelistener(&ssd->dcl);
 }
 
-- 
1.8.3.1



More information about the Spice-devel mailing list