From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NUmWi-0004pA-Ew for qemu-devel@nongnu.org; Tue, 12 Jan 2010 14:35:40 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NUmWd-0004j6-Rt for qemu-devel@nongnu.org; Tue, 12 Jan 2010 14:35:39 -0500 Received: from [199.232.76.173] (port=57889 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NUmWd-0004in-G7 for qemu-devel@nongnu.org; Tue, 12 Jan 2010 14:35:35 -0500 Received: from qw-out-1920.google.com ([74.125.92.148]:5587) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NUmWd-0003Wm-1I for qemu-devel@nongnu.org; Tue, 12 Jan 2010 14:35:35 -0500 Received: by qw-out-1920.google.com with SMTP id 14so116136qwa.4 for ; Tue, 12 Jan 2010 11:35:34 -0800 (PST) Message-ID: <4B4CCF01.4030605@codemonkey.ws> Date: Tue, 12 Jan 2010 13:35:29 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] vnc_refresh: return if vd->timer is NULL References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefano Stabellini Cc: qemu-devel@nongnu.org On 01/11/2010 11:30 AM, Stefano Stabellini wrote: > 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 > Applied. Thanks. Regards, Anthony Liguori > --- > > 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; > > > >