mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-18 23:52:14 -06: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
1 changed files with 4 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue