summaryrefslogtreecommitdiff
path: root/block/qcow2-refcount.c
diff options
context:
space:
mode:
authorZhang Haoyu <zhanghy@sangfor.com>2014-10-11 16:35:43 +0800
committerKevin Wolf <kwolf@redhat.com>2014-10-20 13:41:26 +0200
commitd8bb71b6227366c188595b91c24a58c9b06e46dd (patch)
tree99f9fdb03c991460ebcd7abe5de5899c5008b0e9 /block/qcow2-refcount.c
parent5f77ef69a195098baddfdc6d189f1b4a94587378 (diff)
downloadqemu-d8bb71b6227366c188595b91c24a58c9b06e46dd.tar.gz
qemu-d8bb71b6227366c188595b91c24a58c9b06e46dd.tar.bz2
qemu-d8bb71b6227366c188595b91c24a58c9b06e46dd.zip
qcow2: fix leak of Qcow2DiscardRegion in update_refcount_discard
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>
Diffstat (limited to 'block/qcow2-refcount.c')
-rw-r--r--block/qcow2-refcount.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 2bcaaf9b98..c31d85a840 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -524,6 +524,7 @@ found:
QTAILQ_REMOVE(&s->discards, p, next);
d->offset = MIN(d->offset, p->offset);
d->bytes += p->bytes;
+ g_free(p);
}
}