qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v3 01/21] migration-test: Use g_free() instead of free()


From: Daniel P . Berrangé
Subject: Re: [PATCH v3 01/21] migration-test: Use g_free() instead of free()
Date: Fri, 24 Jan 2020 10:39:07 +0000
User-agent: Mutt/1.12.1 (2019-06-15)

On Thu, Jan 23, 2020 at 12:58:11PM +0100, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <address@hidden>
> ---
>  tests/qtest/migration-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index 26e2e77289..b6a74a05ce 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -1291,7 +1291,7 @@ static void test_multifd_tcp(void)
>      wait_for_serial("dest_serial");
>      wait_for_migration_complete(from);
>      test_migrate_end(from, to, true);
> -    free(uri);
> +    g_free(uri);

Not an objection to this patch, just a general FYI.

Our min glib guarantees that g_malloc/g_free are always using the
system allocator. So using free() is not a correctness problem
these days.

In general I'd suggest eliminating both free() and g_free(), and instead
annotating the variable decl for automatic free. eg

  g_autofree char *uri = NULL;


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

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