From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpJ2i-0004YW-DH for qemu-devel@nongnu.org; Thu, 12 Jul 2012 09:03:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SpJ2M-0005hd-7U for qemu-devel@nongnu.org; Thu, 12 Jul 2012 09:02:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpJ2L-0005gz-W3 for qemu-devel@nongnu.org; Thu, 12 Jul 2012 09:02:30 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6CD2Sbv006923 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 12 Jul 2012 09:02:28 -0400 From: Kevin Wolf Date: Thu, 12 Jul 2012 15:02:25 +0200 Message-Id: <1342098145-9440-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH] qemu-io: Fix memory leaks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com Almost all callers of create_iovec() forgot to destroy the qiov when the request has completed. Signed-off-by: Kevin Wolf --- 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