From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MGIxQ-00034j-O8 for qemu-devel@nongnu.org; Mon, 15 Jun 2009 16:39:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MGIxL-00032i-Ma for qemu-devel@nongnu.org; Mon, 15 Jun 2009 16:39:08 -0400 Received: from [199.232.76.173] (port=43068 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGIxL-00032d-HE for qemu-devel@nongnu.org; Mon, 15 Jun 2009 16:39:03 -0400 Received: from mx2.redhat.com ([66.187.237.31]:34397) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MGIxK-0005aG-TT for qemu-devel@nongnu.org; Mon, 15 Jun 2009 16:39:03 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5FKd2WC022268 for ; Mon, 15 Jun 2009 16:39:02 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5FKd1h8007507 for ; Mon, 15 Jun 2009 16:39:01 -0400 Received: from doriath (vpn-10-127.bos.redhat.com [10.16.10.127]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5FKd08C012577 for ; Mon, 15 Jun 2009 16:39:00 -0400 Date: Mon, 15 Jun 2009 17:38:58 -0300 From: Luiz Capitulino Message-ID: <20090615173858.31514f4f@doriath> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] monitor: check for readline in monitor_event() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel The call of readline_show_prompt() in CHR_EVENT_RESET's body will trig a segfault if readline is not being used, because 'mon->rs' will be NULL. This fixes the problem by adding the proper check. I've trigged this while playing with an off-tree code that disables readline support, I'm not sure whether in-tree code can trig this. Signed-off-by: Luiz Capitulino --- monitor.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/monitor.c b/monitor.c index 6b45f6c..787101d 100644 --- a/monitor.c +++ b/monitor.c @@ -3002,7 +3002,7 @@ static void monitor_event(void *opaque, int event) case CHR_EVENT_RESET: monitor_printf(mon, "QEMU %s monitor - type 'help' for more " "information\n", QEMU_VERSION); - if (mon->chr->focus == 0) + if (mon->rs && mon->chr->focus == 0) readline_show_prompt(mon->rs); break; } -- 1.6.3.GIT