From patchwork Thu May 26 19:56:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 97759 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 82350B6F91 for ; Sat, 28 May 2011 10:25:35 +1000 (EST) Received: from localhost ([::1]:57133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQ7LQ-0003Gg-Q4 for incoming@patchwork.ozlabs.org; Fri, 27 May 2011 20:25:32 -0400 Received: from eggs.gnu.org ([140.186.70.92]:39646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQ7LB-0003A0-5G for qemu-devel@nongnu.org; Fri, 27 May 2011 20:25:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQ7LA-0008HB-HJ for qemu-devel@nongnu.org; Fri, 27 May 2011 20:25:17 -0400 Received: from cantor.suse.de ([195.135.220.2]:37573 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQ7LA-0008H5-Ci for qemu-devel@nongnu.org; Fri, 27 May 2011 20:25:16 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id F2A0194033 for ; Sat, 28 May 2011 02:25:15 +0200 (CEST) From: Alexander Graf To: "qemu-devel@nongnu.org Developers" Date: Thu, 26 May 2011 21:56:22 +0200 Message-Id: <1306439782-25277-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.2 Subject: [Qemu-devel] [PATCH] Fix segfault on screendump with -nographic X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When running -nographic and calling "screendump" on the monitor, qemu segfaults. Fix the invalid pointer dereference by checking for NULL. Signed-off-by: Alexander Graf --- console.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/console.c b/console.c index 871c1d4..9c6addf 100644 --- a/console.c +++ b/console.c @@ -180,7 +180,7 @@ void vga_hw_screen_dump(const char *filename) active_console = consoles[0]; /* There is currently no way of specifying which screen we want to dump, so always dump the first one. */ - if (consoles[0]->hw_screen_dump) + if (consoles[0] && consoles[0]->hw_screen_dump) consoles[0]->hw_screen_dump(consoles[0]->hw, filename); active_console = previous_active_console; }