From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Corentin Chary Date: Fri, 25 Feb 2011 22:54:53 +0100 Message-Id: <1298670893-15157-1-git-send-email-corentincj@iksaif.net> In-Reply-To: References: Subject: [Qemu-devel] [PATCH] vnc: fix a memory leak in threaded vnc server List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bruce Rogers Cc: Corentin Chary , Stefan Hajnoczi , Alexander Graf , qemu-devel@nongnu.org, Blue Swirl , Anthony Liguori , =?UTF-8?q?Torsten=20F=C3=B6rtsch?= 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) -- 1.7.4