From patchwork Fri Feb 25 21:54:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 84575 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 BE0E8B6F0B for ; Sat, 26 Feb 2011 08:55:45 +1100 (EST) Received: from localhost ([127.0.0.1]:42535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pt5dV-0003GY-If for incoming@patchwork.ozlabs.org; Fri, 25 Feb 2011 16:55:41 -0500 Received: from [140.186.70.92] (port=39826 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pt5cx-0003GM-JV for qemu-devel@nongnu.org; Fri, 25 Feb 2011 16:55:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pt5cs-00054x-5a for qemu-devel@nongnu.org; Fri, 25 Feb 2011 16:55:07 -0500 Received: from relay1-v.mail.gandi.net ([217.70.178.75]:35676) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pt5cr-00054W-SQ for qemu-devel@nongnu.org; Fri, 25 Feb 2011 16:55:02 -0500 X-Originating-IP: 217.70.178.37 Received: from mfilter3-v.gandi.net (mfilter3-v.gandi.net [217.70.178.37]) by relay1-v.mail.gandi.net (Postfix) with ESMTP id 65A4E362AA; Fri, 25 Feb 2011 22:55:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter3-v.gandi.net Received: from relay1-v.mail.gandi.net ([217.70.178.75]) by mfilter3-v.gandi.net (mfilter3-v.gandi.net [217.70.178.37]) (amavisd-new, port 10024) with ESMTP id O3kXKS3lVgYt; Fri, 25 Feb 2011 22:54:59 +0100 (CET) X-Originating-IP: 82.241.209.44 Received: from localhost.localdomain (falgoret.iksaif.net [82.241.209.44]) (Authenticated sender: fake@iksaif.net) by relay1-v.mail.gandi.net (Postfix) with ESMTPSA id 11301362BF; Fri, 25 Feb 2011 22:54:56 +0100 (CET) From: Corentin Chary To: Bruce Rogers Date: Fri, 25 Feb 2011 22:54:53 +0100 Message-Id: <1298670893-15157-1-git-send-email-corentincj@iksaif.net> X-Mailer: git-send-email 1.7.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 217.70.178.75 Cc: Corentin Chary , Stefan Hajnoczi , Alexander Graf , qemu-devel@nongnu.org, Blue Swirl , Anthony Liguori , =?UTF-8?q?Torsten=20F=C3=B6rtsch?= Subject: [Qemu-devel] [PATCH] vnc: fix a memory leak in threaded vnc server 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 VncJobQueue's buffer is intended to be used for as the output buffer for all operations in this queue, but unfortunatly. vnc_async_encoding_start() is in charge of setting this buffer as the current output buffer, but vnc_async_encoding_end() was not writting the changes back to VncJobQueue, resulting in a big and ugly memleak. Signed-off-by: Corentin Chary --- I believe this is a (slightly) better patch than Bruce's one, because it reduce memory allocations by using always the same buffer. ui/vnc-jobs-async.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/ui/vnc-jobs-async.c b/ui/vnc-jobs-async.c index 1d4c5e7..f596247 100644 --- a/ui/vnc-jobs-async.c +++ b/ui/vnc-jobs-async.c @@ -186,6 +186,8 @@ static void vnc_async_encoding_end(VncState *orig, VncState *local) orig->hextile = local->hextile; orig->zrle = local->zrle; orig->lossy_rect = local->lossy_rect; + + queue->buffer = local->output; } static int vnc_worker_thread_loop(VncJobQueue *queue)