cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
Blob Blame History Raw
From b0f23a00b51a43aefe975fd2748c9b079a499d95 Mon Sep 17 00:00:00 2001
From: Max Reitz <mreitz@redhat.com>
Date: Sat, 13 Jun 2015 16:22:06 +0200
Subject: [PATCH 12/42] qcow2: fix leak of Qcow2DiscardRegion in
 update_refcount_discard

Message-id: <1434212556-3927-13-git-send-email-mreitz@redhat.com>
Patchwork-id: 66031
O-Subject: [RHEL-7.2 qemu-kvm PATCH 12/42] qcow2: fix leak of Qcow2DiscardRegion in update_refcount_discard
Bugzilla: 1129893
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
RH-Acked-by: Fam Zheng <famz@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>

From: Zhang Haoyu <zhanghy@sangfor.com>

BZ: 1129893

When the Qcow2DiscardRegion is adjacent to another one referenced by "d",
free this Qcow2DiscardRegion metadata referenced by "p" after
it was removed from s->discards queue.

Signed-off-by: Zhang Haoyu <zhanghy@sangfor.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit d8bb71b6227366c188595b91c24a58c9b06e46dd)

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 block/qcow2-refcount.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index e66d593..0c5a6ad 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -509,6 +509,7 @@ found:
         QTAILQ_REMOVE(&s->discards, p, next);
         d->offset = MIN(d->offset, p->offset);
         d->bytes += p->bytes;
+        g_free(p);
     }
 }
 
-- 
1.8.3.1