From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrADZ-0007py-J0 for qemu-devel@nongnu.org; Tue, 17 Jul 2012 12:01:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SrADT-00063H-6b for qemu-devel@nongnu.org; Tue, 17 Jul 2012 12:01:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6732) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrADS-000639-Vu for qemu-devel@nongnu.org; Tue, 17 Jul 2012 12:01:39 -0400 From: Kevin Wolf Date: Tue, 17 Jul 2012 18:00:33 +0200 Message-Id: <1342540838-9027-37-git-send-email-kwolf@redhat.com> In-Reply-To: <1342540838-9027-1-git-send-email-kwolf@redhat.com> References: <1342540838-9027-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 36/41] qemu-io: Fix memory leaks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org Almost all callers of create_iovec() forgot to destroy the qiov when the request has completed. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- 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