qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-io: Fix memory leaks
@ 2012-07-12 13:02 Kevin Wolf
  2012-07-16 11:38 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wolf @ 2012-07-12 13:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

Almost all callers of create_iovec() forgot to destroy the qiov when the
request has completed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-io.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/qemu-io.c b/qemu-io.c
index 5882067..8f3b94b 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -670,6 +670,7 @@ static int readv_f(int argc, char **argv)
     print_report("read", &t2, offset, qiov.size, total, cnt, Cflag);
 
 out:
+    qemu_iovec_destroy(&qiov);
     qemu_io_free(buf);
     return 0;
 }
@@ -928,6 +929,7 @@ static int writev_f(int argc, char **argv)
     t2 = tsub(t2, t1);
     print_report("wrote", &t2, offset, qiov.size, total, cnt, Cflag);
 out:
+    qemu_iovec_destroy(&qiov);
     qemu_io_free(buf);
     return 0;
 }
@@ -1126,6 +1128,7 @@ static void aio_write_done(void *opaque, int ret)
                  ctx->qiov.size, 1, ctx->Cflag);
 out:
     qemu_io_free(ctx->buf);
+    qemu_iovec_destroy(&ctx->qiov);
     g_free(ctx);
 }
 
@@ -1166,6 +1169,7 @@ static void aio_read_done(void *opaque, int ret)
                  ctx->qiov.size, 1, ctx->Cflag);
 out:
     qemu_io_free(ctx->buf);
+    qemu_iovec_destroy(&ctx->qiov);
     g_free(ctx);
 }
 
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-io: Fix memory leaks
  2012-07-12 13:02 [Qemu-devel] [PATCH] qemu-io: Fix memory leaks Kevin Wolf
@ 2012-07-16 11:38 ` Stefan Hajnoczi
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2012-07-16 11:38 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

On Thu, Jul 12, 2012 at 2:02 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> Almost all callers of create_iovec() forgot to destroy the qiov when the
> request has completed.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  qemu-io.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-16 11:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-12 13:02 [Qemu-devel] [PATCH] qemu-io: Fix memory leaks Kevin Wolf
2012-07-16 11:38 ` Stefan Hajnoczi

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).