qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH V2] vhost-user-test: fix a memory leak


From: Thomas Huth
Subject: Re: [PATCH V2] vhost-user-test: fix a memory leak
Date: Fri, 10 Jan 2020 15:07:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 20/12/2019 02.26, address@hidden wrote:
> From: Pan Nengyuan <address@hidden>
> 
> Spotted by ASAN.
> 
> Reported-by: Euler Robot <address@hidden>
> Signed-off-by: Pan Nengyuan <address@hidden>
> ---
> Changes V2 to V1:
> - use a "goto cleanup", instead of duplicating the "free" functions.
> - free "dest_cmdline" at the end.
> ---
>  tests/vhost-user-test.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
> index 91ea373..dcb8617 100644
> --- a/tests/vhost-user-test.c
> +++ b/tests/vhost-user-test.c
> @@ -717,7 +717,7 @@ static void test_migrate(void *obj, void *arg, 
> QGuestAllocator *alloc)
>      guint64 size;
>  
>      if (!wait_for_fds(s)) {
> -        return;
> +        goto cleanup;
>      }
>  
>      size = get_log_size(s);
> @@ -776,8 +776,11 @@ static void test_migrate(void *obj, void *arg, 
> QGuestAllocator *alloc)
>      g_source_unref(source);
>  
>      qtest_quit(to);
> +
> + cleanup:
>      test_server_free(dest);
>      g_free(uri);
> +    g_string_free(dest_cmdline, true);
>  }
>  
>  static void wait_for_rings_started(TestServer *s, size_t count)
> 

Reviewed-by: Thomas Huth <address@hidden>

... and picked up to my qtest-next tree.




reply via email to

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