mirror of https://gitee.com/openkylin/qemu.git
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>
This commit is contained in:
parent
53c2e71632
commit
a161329b61
|
@ -315,7 +315,6 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file)
|
||||||
ret = -errno;
|
ret = -errno;
|
||||||
goto fail_rgd;
|
goto fail_rgd;
|
||||||
}
|
}
|
||||||
qemu_free(rgd_buf);
|
|
||||||
|
|
||||||
/* write GD */
|
/* write GD */
|
||||||
gd_buf = qemu_malloc(gd_size);
|
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;
|
goto fail_gd;
|
||||||
}
|
}
|
||||||
qemu_free(gd_buf);
|
qemu_free(gd_buf);
|
||||||
|
qemu_free(rgd_buf);
|
||||||
|
|
||||||
close(p_fd);
|
close(p_fd);
|
||||||
close(snp_fd);
|
close(snp_fd);
|
||||||
|
|
Loading…
Reference in New Issue