qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Corentin Chary <corentincj@iksaif.net>
To: Bruce Rogers <brogers@novell.com>
Cc: "Corentin Chary" <corentincj@iksaif.net>,
	"Stefan Hajnoczi" <stefanha@gmail.com>,
	"Alexander Graf" <agraf@suse.de>,
	qemu-devel@nongnu.org, "Blue Swirl" <blauwirbel@gmail.com>,
	"Anthony Liguori" <aliguori@linux.vnet.ibm.com>,
	"Torsten Förtsch" <torsten.foertsch@gmx.net>
Subject: [Qemu-devel] [PATCH] vnc: fix a memory leak in threaded vnc server
Date: Fri, 25 Feb 2011 22:54:53 +0100	[thread overview]
Message-ID: <1298670893-15157-1-git-send-email-corentincj@iksaif.net> (raw)
In-Reply-To: <D6799E202000048000AA8EC@novprvoes0310.provo.novell.com>

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 <corentincj@iksaif.net>
---
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

       reply	other threads:[~2011-02-25 21:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <D6799E202000048000AA8EC@novprvoes0310.provo.novell.com>
2011-02-25 21:54 ` Corentin Chary [this message]
2011-02-25 22:50   ` [Qemu-devel] [PATCH] vnc: fix a memory leak in threaded vnc server Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1298670893-15157-1-git-send-email-corentincj@iksaif.net \
    --to=corentincj@iksaif.net \
    --cc=agraf@suse.de \
    --cc=aliguori@linux.vnet.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=brogers@novell.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=torsten.foertsch@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).