mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07: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:
@@ -279,6 +279,10 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
if (snapshots_offset > 0) {
|
||||
qcow2_free_clusters(bs, snapshots_offset, snapshots_size,
|
||||
QCOW2_DISCARD_ALWAYS);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user