aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2010-03-04 10:00:36 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-03-09 11:23:00 -0600
commita161329b61106ab093aab6d3227ac85e0b8251a9 (patch)
treec7999d3dfd8316ea06350d8aa7c8c75b6cd5db1f
parent53c2e71632340bc7f0d4cfdc4c5f21e270112b6c (diff)
vmdk: fix double free
fail_gd error case would also free rgd_buf that was already freed Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--block/vmdk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index 67a690e255..819c1c9fc5 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -315,7 +315,6 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file)
ret = -errno;
goto fail_rgd;
}
- qemu_free(rgd_buf);
/* write GD */
gd_buf = qemu_malloc(gd_size);
@@ -336,6 +335,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file)
goto fail_gd;
}
qemu_free(gd_buf);
+ qemu_free(rgd_buf);
close(p_fd);
close(snp_fd);