[libvirt] [PATCH 1/3] qemu_hotplug.c: use VIR_AUTOFREE() in strings 1/3

Erik Skultety eskultet at redhat.com
Mon Sep 23 07:36:01 UTC 2019


On Wed, Sep 18, 2019 at 04:53:06PM -0300, Daniel Henrique Barboza wrote:
> Using VIR_AUTOFREE() spare us from calling VIR_VREE() and
> sometimes a whole 'cleanup' label can be erased as well.
>
> There are quite a few strings in qemu_hotplug.c to be
> auto-freed. This is the first part of this change.
>
> Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
> ---
[...]

> @@ -517,7 +507,7 @@ qemuDomainChangeMediaBlockdev(virQEMUDriverPtr driver,
>      qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
>      VIR_AUTOPTR(qemuBlockStorageSourceChainData) newbackend = NULL;
>      VIR_AUTOPTR(qemuBlockStorageSourceChainData) oldbackend = NULL;
> -    char *nodename = NULL;
> +    VIR_AUTOFREE(char *) nodename = NULL;
>      int rc;
>      int ret = -1;
>
> @@ -572,7 +562,6 @@ qemuDomainChangeMediaBlockdev(virQEMUDriverPtr driver,
>      ret = 0;
>
>   cleanup:

^This cleanup label can be dropped as well after the change.

Erik




More information about the libvir-list mailing list