cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 8dddbd7dc9948e743695166bab2b7ca94012badf Mon Sep 17 00:00:00 2001
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Date: Fri, 7 Feb 2014 15:29:00 +0100
9ae3a8
Subject: [PATCH 25/37] lock: Fix memory leaks in bdrv_co_do_pwritev()
9ae3a8
9ae3a8
Message-id: <1392117622-28812-26-git-send-email-kwolf@redhat.com>
9ae3a8
Patchwork-id: 57190
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 25/37] block: Fix memory leaks in bdrv_co_do_pwritev()
9ae3a8
Bugzilla: 748906
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
9ae3a8
The error path for a failure in one of the two bdrv_aligned_preadv()
9ae3a8
calls leaked head_buf or tail_buf, respectively. This fixes the memory
9ae3a8
leak.
9ae3a8
9ae3a8
Reported-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Reviewed-by: Eric Blake <eblake@redhat.com>
9ae3a8
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
---
9ae3a8
 block.c | 4 ++--
9ae3a8
 1 file changed, 2 insertions(+), 2 deletions(-)
9ae3a8
---
9ae3a8
 block.c |    4 ++--
9ae3a8
 1 files changed, 2 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
diff --git a/block.c b/block.c
9ae3a8
index 3ec3949..9eeb072 100644
9ae3a8
--- a/block.c
9ae3a8
+++ b/block.c
9ae3a8
@@ -3180,9 +3180,9 @@ fail:
9ae3a8
 
9ae3a8
     if (use_local_qiov) {
9ae3a8
         qemu_iovec_destroy(&local_qiov);
9ae3a8
-        qemu_vfree(head_buf);
9ae3a8
-        qemu_vfree(tail_buf);
9ae3a8
     }
9ae3a8
+    qemu_vfree(head_buf);
9ae3a8
+    qemu_vfree(tail_buf);
9ae3a8
 
9ae3a8
     return ret;
9ae3a8
 }
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8