From patchwork Sat Sep 19 19:00:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 33950 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 9B32FB7B7D for ; Sun, 20 Sep 2009 05:00:49 +1000 (EST) Received: from localhost ([127.0.0.1]:54143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mp5At-0000M0-1N for incoming@patchwork.ozlabs.org; Sat, 19 Sep 2009 15:00:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mp5AQ-0000LC-IA for qemu-devel@nongnu.org; Sat, 19 Sep 2009 15:00:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mp5AM-0000KV-5c for qemu-devel@nongnu.org; Sat, 19 Sep 2009 15:00:18 -0400 Received: from [199.232.76.173] (port=42259 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mp5AL-0000KS-VZ for qemu-devel@nongnu.org; Sat, 19 Sep 2009 15:00:14 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:61020) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mp5AL-0004IJ-9H for qemu-devel@nongnu.org; Sat, 19 Sep 2009 15:00:13 -0400 Received: from flocke.weilnetz.de (p54ADEC1D.dip.t-dialin.net [84.173.236.29]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MKt72-1Mp5AI3gqk-000gwp; Sat, 19 Sep 2009 21:00:11 +0200 Received: from stefan by flocke.weilnetz.de with local (Exim 4.69) (envelope-from ) id 1Mp5AI-0003ym-11; Sat, 19 Sep 2009 21:00:10 +0200 From: Stefan Weil To: QEMU Developers Date: Sat, 19 Sep 2009 21:00:09 +0200 Message-Id: <1253386809-15268-1-git-send-email-weil@mail.berlios.de> X-Mailer: git-send-email 1.5.6.5 X-Provags-ID: V01U2FsdGVkX1+x2Bs71sun4IGrZ3ovgnOaG2cBhKu+BWBZaAN uIaeKh1mwhUQYA2VDRhz7TNpZFjEqo37WD6VAY8lKgF4RGph3n 0K/bmdGTahYaqWF5hP93o6KfcDLX50WyDKgZjItybl7iWg9a4i +9w== X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH] vnc: Set invalid buffer pointers to 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 After qemu_free, the pointers for input and output buffers are no longer valid, so set them to NULL (most other calls of qemu_free in vnc.c use this pattern, too). Signed-off-by: Stefan Weil --- vnc.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/vnc.c b/vnc.c index 5eaef6a..433b514 100644 --- a/vnc.c +++ b/vnc.c @@ -894,8 +894,14 @@ static void vnc_disconnect_start(VncState *vs) static void vnc_disconnect_finish(VncState *vs) { - if (vs->input.buffer) qemu_free(vs->input.buffer); - if (vs->output.buffer) qemu_free(vs->output.buffer); + if (vs->input.buffer) { + qemu_free(vs->input.buffer); + vs->input.buffer = NULL; + } + if (vs->output.buffer) { + qemu_free(vs->output.buffer); + vs->output.buffer = NULL; + } #ifdef CONFIG_VNC_TLS vnc_tls_client_cleanup(vs); #endif /* CONFIG_VNC_TLS */