[libvirt PATCH 6/6] tools: report messages for 'dominfo' command

Pino Toscano ptoscano at redhat.com
Fri Feb 5 14:34:51 UTC 2021


On Friday, 5 February 2021 15:18:31 CET Daniel P. Berrangé wrote:
> diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
> index 02ff1fbd62..df24543ef8 100644
> --- a/tools/virsh-domain-monitor.c
> +++ b/tools/virsh-domain-monitor.c
> @@ -1291,6 +1291,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
>      char *str, uuid[VIR_UUID_STRING_BUFLEN];
>      int has_managed_save = 0;
>      virshControlPtr priv = ctl->privData;
> +    char **messages = NULL;
>  
>      if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
>          return false;
> @@ -1391,6 +1392,18 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
>              VIR_FREE(seclabel);
>          }
>      }
> +
> +    if (virDomainGetMessages(dom, &messages, 0) > 0) {
> +        size_t i;
> +        for (i = 0; messages[i] != NULL; i++) {
> +            if (i == 0) {
> +                vshPrint(ctl, "%-15s %s\n", _("Messages:"), messages[i]);
> +            } else {
> +                vshPrint(ctl, "%-15s %s\n", "", messages[i]);
> +            }
> +        }
> +    }

'messages' is leaked here.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210205/49c47021/attachment-0001.sig>


More information about the libvir-list mailing list