[PATCH] virsh: Fix resource leak while listing inactive domains with titles

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

 



Commit fad5cd210899dfde4afe36712754dc921c3f3051 introduces a new flag
that allows to show domain's title with domains. This commit introduced
resource leak while listing inactive domains with titles.
---
Sadly, I missed this even when it was incorrectly intended. :(
(extra context for easier review)

 tools/virsh.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 1613d2e..d6fe680 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1000,34 +1000,34 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
         if (desc) {
             if (!(title = vshGetDomainDescription(ctl, dom, true, 0)))
                 goto cleanup;

             vshPrint(ctl, "%-5s %-30s %-10s %s\n",
                      "-",
                      names[i],
                      state == -2 ? _("saved") : _(vshDomainStateToString(state)),
                      title);
             VIR_FREE(title);
         } else {
             vshPrint(ctl, " %-5s %-30s %s\n",
                      "-",
                      names[i],
                      state == -2 ? _("saved") : _(vshDomainStateToString(state)));
+        }

         virDomainFree(dom);
         VIR_FREE(names[i]);
-        }
     }

     ret = true;
 cleanup:
     VIR_FREE(ids);
     VIR_FREE(names);
     return ret;
 }

 /*
  * "desc" command for managing domain description and title
  */
 static const vshCmdInfo info_desc[] = {
     {"help", N_("show or set domain's description or title")},
     {"desc", N_("Allows to show or modify description or title of a domain.")},
-- 
1.7.3.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[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]