qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 4/4] block: Fix how mirror_run() frees its buffe


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 4/4] block: Fix how mirror_run() frees its buffer
Date: Tue, 15 Jan 2013 14:52:06 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

Am 15.01.2013 14:23, schrieb Markus Armbruster:
> It allocates with qemu_blockalign(), therefore it must free with
> qemu_vfree(), not g_free().
> 
> Since I'm touching it anyway, move the free to a more obviosly correct
> place.

...except that it's now leaked for all error cases but the first.

Kevin

> Signed-off-by: Markus Armbruster <address@hidden>
> ---
>  block/mirror.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/mirror.c b/block/mirror.c
> index 8aeacbf..27a7d8c 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -223,9 +223,9 @@ static void coroutine_fn mirror_run(void *opaque)
>              break;
>          }
>      }
> +    qemu_vfree(s->buf);
>  
>  immediate_exit:
> -    g_free(s->buf);
>      bdrv_set_dirty_tracking(bs, false);
>      bdrv_iostatus_disable(s->target);
>      if (s->should_complete && ret == 0) {
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]