From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3h3X-0000jU-VY for qemu-devel@nongnu.org; Fri, 20 May 2016 05:49:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3h3S-0004V2-VO for qemu-devel@nongnu.org; Fri, 20 May 2016 05:49:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51237) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3h3S-0004Uv-Pu for qemu-devel@nongnu.org; Fri, 20 May 2016 05:49:14 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2FEB7F6B0 for ; Fri, 20 May 2016 09:49:12 +0000 (UTC) From: Gerd Hoffmann Date: Fri, 20 May 2016 11:49:08 +0200 Message-Id: <1463737748-1062-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH] gtk: fix unchecked vc dereference List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Paolo Bonzini Spotted by Coverity. Cc: Paolo Bonzini Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index 7572cec..01b8216 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1477,13 +1477,14 @@ static void gd_grab_pointer(VirtualConsole *vc, const char *reason) static void gd_ungrab_pointer(GtkDisplayState *s) { VirtualConsole *vc = s->ptr_owner; - GdkDisplay *display = gtk_widget_get_display(vc->gfx.drawing_area); + GdkDisplay *display; if (vc == NULL) { return; } s->ptr_owner = NULL; + display = gtk_widget_get_display(vc->gfx.drawing_area); #if GTK_CHECK_VERSION(3, 20, 0) gd_grab_update(vc, vc->s->kbd_owner == vc, false); gdk_device_warp(gd_get_pointer(display), -- 1.8.3.1