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

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

 



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

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux