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

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


On Wed, Sep 18, 2019 at 04:53:07PM -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 second part of this change.
>
> Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
> ---
[...]

>   exit_monitor:
> @@ -3986,22 +3969,21 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
>      qemuDomainObjPrivatePtr priv = vm->privateData;
>      time_t now = time(NULL);
>      const char *expire;
> -    char *validTo = NULL;
> +    VIR_AUTOFREE(char *) validTo = NULL;
>      const char *connected = NULL;
>      const char *password;
>      int ret = -1;
>
> -    if (!auth->passwd && !defaultPasswd) {
> -        ret = 0;
> -        goto cleanup;
> -    }
> +    if (!auth->passwd && !defaultPasswd)
> +        return ret;

Not quite, originally ret == 0 upon return, now it's -1.

Erik




More information about the libvir-list mailing list