From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49455 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pt6Ua-0006y7-Nc for qemu-devel@nongnu.org; Fri, 25 Feb 2011 17:50:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pt6UH-0005ZS-Fi for qemu-devel@nongnu.org; Fri, 25 Feb 2011 17:50:32 -0500 Received: from e9.ny.us.ibm.com ([32.97.182.139]:54290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pt6UH-0005Ww-5c for qemu-devel@nongnu.org; Fri, 25 Feb 2011 17:50:13 -0500 Received: from d01dlp01.pok.ibm.com (d01dlp01.pok.ibm.com [9.56.224.56]) by e9.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p1PMOBoP020649 for ; Fri, 25 Feb 2011 17:24:15 -0500 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 87A6638C803C for ; Fri, 25 Feb 2011 17:50:07 -0500 (EST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p1PMo7vC363252 for ; Fri, 25 Feb 2011 17:50:07 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p1PMo7Fi007162 for ; Fri, 25 Feb 2011 17:50:07 -0500 Message-ID: <4D68321C.90800@linux.vnet.ibm.com> Date: Fri, 25 Feb 2011 16:50:04 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] vnc: fix a memory leak in threaded vnc server References: <1298670893-15157-1-git-send-email-corentincj@iksaif.net> In-Reply-To: <1298670893-15157-1-git-send-email-corentincj@iksaif.net> 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: Corentin Chary Cc: Bruce Rogers , Stefan Hajnoczi , qemu-devel@nongnu.org, Alexander Graf , Blue Swirl , =?ISO-8859-1?Q?Torsten_F=F6rtsch?= On 02/25/2011 03:54 PM, Corentin Chary wrote: > 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 > Applied. Thanks. Regards, Anthony Liguori > --- > 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) >