[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V2 1/2] qcow2: free allocated cluster on fail in
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH V2 1/2] qcow2: free allocated cluster on fail in qcow2_write_snapshots() |
Date: |
Fri, 17 May 2013 11:19:20 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, May 17, 2013 at 03:56:44PM +0800, Wenchao Xia wrote:
> Signed-off-by: Wenchao Xia <address@hidden>
> ---
> block/qcow2-snapshot.c | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
> index 992a5c8..45da32d 100644
> --- a/block/qcow2-snapshot.c
> +++ b/block/qcow2-snapshot.c
> @@ -180,13 +180,13 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
>
> /* Allocate space for the new snapshot list */
> snapshots_offset = qcow2_alloc_clusters(bs, snapshots_size);
> - offset = snapshots_offset;
> - if (offset < 0) {
> - return offset;
> + ret = offset = snapshots_offset;
> + if (ret < 0) {
> + goto fail;
> }
If qcow2_alloc_clusters() failed then we must not call
qcow2_free_clusters().