cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From b0f23a00b51a43aefe975fd2748c9b079a499d95 Mon Sep 17 00:00:00 2001
9ae3a8
From: Max Reitz <mreitz@redhat.com>
9ae3a8
Date: Sat, 13 Jun 2015 16:22:06 +0200
9ae3a8
Subject: [PATCH 12/42] qcow2: fix leak of Qcow2DiscardRegion in
9ae3a8
 update_refcount_discard
9ae3a8
9ae3a8
Message-id: <1434212556-3927-13-git-send-email-mreitz@redhat.com>
9ae3a8
Patchwork-id: 66031
9ae3a8
O-Subject: [RHEL-7.2 qemu-kvm PATCH 12/42] qcow2: fix leak of Qcow2DiscardRegion in update_refcount_discard
9ae3a8
Bugzilla: 1129893
9ae3a8
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
From: Zhang Haoyu <zhanghy@sangfor.com>
9ae3a8
9ae3a8
BZ: 1129893
9ae3a8
9ae3a8
When the Qcow2DiscardRegion is adjacent to another one referenced by "d",
9ae3a8
free this Qcow2DiscardRegion metadata referenced by "p" after
9ae3a8
it was removed from s->discards queue.
9ae3a8
9ae3a8
Signed-off-by: Zhang Haoyu <zhanghy@sangfor.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit d8bb71b6227366c188595b91c24a58c9b06e46dd)
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block/qcow2-refcount.c | 1 +
9ae3a8
 1 file changed, 1 insertion(+)
9ae3a8
9ae3a8
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
9ae3a8
index e66d593..0c5a6ad 100644
9ae3a8
--- a/block/qcow2-refcount.c
9ae3a8
+++ b/block/qcow2-refcount.c
9ae3a8
@@ -509,6 +509,7 @@ found:
9ae3a8
         QTAILQ_REMOVE(&s->discards, p, next);
9ae3a8
         d->offset = MIN(d->offset, p->offset);
9ae3a8
         d->bytes += p->bytes;
9ae3a8
+        g_free(p);
9ae3a8
     }
9ae3a8
 }
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8