mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-07 14:18:51 +00:00
qcow2: Free allocated snapshot table on error
If an error occurs during qcow2_write_snapshots, the newly allocated snapshot table clusters are leaked and should thus be freed. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
37d41f0a04
commit
9186ad9658
@ -279,6 +279,10 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
if (snapshots_offset > 0) {
|
||||||
|
qcow2_free_clusters(bs, snapshots_offset, snapshots_size,
|
||||||
|
QCOW2_DISCARD_ALWAYS);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user