From patchwork Mon Jan 11 17:30:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 42647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3CB08B6F08 for ; Tue, 12 Jan 2010 04:53:26 +1100 (EST) Received: from localhost ([127.0.0.1]:38752 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NUORO-0004Dq-Pe for incoming@patchwork.ozlabs.org; Mon, 11 Jan 2010 12:52:34 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NUO5N-0007Pj-S4 for qemu-devel@nongnu.org; Mon, 11 Jan 2010 12:29:49 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NUO5J-0007Md-W8 for qemu-devel@nongnu.org; Mon, 11 Jan 2010 12:29:49 -0500 Received: from [199.232.76.173] (port=52943 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NUO5J-0007MP-LK for qemu-devel@nongnu.org; Mon, 11 Jan 2010 12:29:45 -0500 Received: from smtp.eu.citrix.com ([62.200.22.115]:26760) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NUO5J-0002NQ-BA for qemu-devel@nongnu.org; Mon, 11 Jan 2010 12:29:45 -0500 X-IronPort-AV: E=Sophos;i="4.49,257,1262563200"; d="scan'208";a="8834643" Received: from lonpmailmx01.citrite.net ([10.30.224.162]) by LONPIPO01.EU.CITRIX.COM with ESMTP; 11 Jan 2010 17:29:35 +0000 Received: from kaball.uk.xensource.com (10.80.2.59) by smtprelay.citrix.com (10.30.224.162) with Microsoft SMTP Server id 8.1.393.1; Mon, 11 Jan 2010 17:29:35 +0000 Date: Mon, 11 Jan 2010 17:30:50 +0000 From: Stefano Stabellini X-X-Sender: sstabellini@kaball-desktop To: qemu-devel@nongnu.org Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH] vnc_refresh: return if vd->timer is NULL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hi all, calling vnc_update_client in vnc_refresh might have the unlikely side effect of setting vd->timer = NULL, if the last vnc client disconnected. In this case we have to return from vnc_refresh without updating the timer, otherwise we cause a segfault. Signed-off-by: Stefano Stabellini diff --git a/vnc.c b/vnc.c index c54c6e0..58eac73 100644 --- a/vnc.c +++ b/vnc.c @@ -2305,6 +2305,10 @@ static void vnc_refresh(void *opaque) rects += vnc_update_client(vs, has_dirty); vs = vs->next; } + /* vd->timer could be NULL now if the last client disconnected, + * in this case don't update the timer */ + if (vd->timer == NULL) + return; if (has_dirty && rects) { vd->timer_interval /= 2;