]> git.proxmox.com Git - mirror_qemu.git/commitdiff
console: Fix segfault on screendump without VGA adapter
authorAlexander Graf <agraf@suse.de>
Fri, 18 Nov 2011 15:41:59 +0000 (16:41 +0100)
committerAlexander Graf <agraf@suse.de>
Tue, 3 Jan 2012 01:49:25 +0000 (02:49 +0100)
When trying to create a screen dump without having any VGA adapter
inside the guest, QEMU segfaults.

This is because it's trying to switch back to the "previous" screen
it was on before dumping the VGA screen. Unfortunately, in my case
there simply is no previous screen so it accesses a NULL pointer.

Fix it by checking if previous_active_console is actually available.

This is 1.0 material.

Signed-off-by: Alexander Graf <agraf@suse.de>
console.c

index 223f8fd9a4563606c348c79c44887914a952e2c9..135394f6f6436927a67187cdd44e5e03561c9c58 100644 (file)
--- a/console.c
+++ b/console.c
@@ -186,7 +186,9 @@ void vga_hw_screen_dump(const char *filename)
         consoles[0]->hw_screen_dump(consoles[0]->hw, filename);
     }
 
-    console_select(previous_active_console->index);
+    if (previous_active_console) {
+        console_select(previous_active_console->index);
+    }
 }
 
 void vga_hw_text_update(console_ch_t *chardata)