]> xenbits.xensource.com Git - qemu-upstream-4.6-testing.git/commitdiff
qcow2: fix leak of Qcow2DiscardRegion in update_refcount_discard
authorZhang Haoyu <zhanghy@sangfor.com>
Sat, 11 Oct 2014 08:35:43 +0000 (16:35 +0800)
committerKevin Wolf <kwolf@redhat.com>
Mon, 20 Oct 2014 11:41:26 +0000 (13:41 +0200)
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>
block/qcow2-refcount.c

index 2bcaaf9b98806ebb93e9c8dc3d028d9aacef2f4b..c31d85a840852a46c5b0aecfaab5441c6353ca54 100644 (file)
@@ -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);
     }
 }