aboutsummaryrefslogtreecommitdiff
path: root/block-qcow2.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-08 19:32:20 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-08 19:32:20 +0000
commit54c16572a03e3c9c5694653361f9bfa3959fcb59 (patch)
tree44c4f50de29cc2048db95cb0c0cc4e8ceea9b55f /block-qcow2.c
parent7f48fa1f05b0db5583fd191aee60f7b4fb7ffda9 (diff)
qcow2: free old snapshots array upon creation of a new one (Uri Lublin)
Don't leak memory Rebased for qemu tree. Signed-off-by: Uri Lublin <uril@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6245 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-qcow2.c')
-rw-r--r--block-qcow2.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block-qcow2.c b/block-qcow2.c
index 707109e449..9aa7261e3f 100644
--- a/block-qcow2.c
+++ b/block-qcow2.c
@@ -2024,6 +2024,7 @@ static int qcow_snapshot_create(BlockDriverState *bs,
if (!snapshots1)
goto fail;
memcpy(snapshots1, s->snapshots, s->nb_snapshots * sizeof(QCowSnapshot));
+ qemu_free(s->snapshots);
s->snapshots = snapshots1;
s->snapshots[s->nb_snapshots++] = *sn;