[PATCH 1/2] virsh: perf: Don't leak domain

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

 



After failing to parse the perf event list, the code would return
failure without freeing the previously acquired object. Rearrange the
code to avoid the problem.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1329046
---
 tools/virsh-domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index a1d4a75..4a73a80 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8623,13 +8623,13 @@ cmdPerf(vshControl *ctl, const vshCmd *cmd)
     if (live)
         flags |= VIR_DOMAIN_AFFECT_LIVE;

-    if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
-        return false;
-
     if (vshCommandOptStringReq(ctl, cmd, "enable", &enable) < 0 ||
         vshCommandOptStringReq(ctl, cmd, "disable", &disable) < 0)
         return false;

+    if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
+        return false;
+
     if (enable && virshParseEventStr(enable, true, &params,
                                      &nparams, &maxparams) < 0)
         goto cleanup;
-- 
2.8.1

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