[Spice-commits] server/reds.c

Alon Levy alon at kemper.freedesktop.org
Wed Jul 6 04:52:31 PDT 2011


 server/reds.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 7e83957d2244be5469702260b3afe147d3784754
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Jun 20 10:55:45 2011 +0200

    server: fix segfault if no migrate_info provided
    
    qemu calls spice_server_migrate_switch even if it didn't do a
    spice_server_migrate_info first. Fix the resulting error by not pushing
    a switch host tag to the pipe in this case, and add a check anyway in the
    marshalling code just in case.

diff --git a/server/reds.c b/server/reds.c
index eb9c32a..ca6cf4d 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3102,12 +3102,23 @@ static void reds_mig_finished(int completed)
 
 static void reds_mig_switch(void)
 {
+    if (!reds->mig_spice) {
+        red_printf("warning: reds_mig_switch called without migrate_info set");
+        return;
+    }
     main_channel_push_migrate_switch(reds->main_channel);
 }
 
 void reds_fill_mig_switch(SpiceMsgMainMigrationSwitchHost *migrate)
 {
     RedsMigSpice *s = reds->mig_spice;
+
+    if (s == NULL) {
+        red_printf(
+            "error: reds_fill_mig_switch called without migrate info set");
+        bzero(migrate, sizeof(*migrate));
+        return;
+    }
     migrate->port = s->port;
     migrate->sport = s->sport;
     migrate->host_size = strlen(s->host) + 1;


More information about the Spice-commits mailing list