[PATCH] virsh-domain: Add a missing check and fix leak in cmdScreenshot

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

 



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

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 856e888..7fe42df 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -4610,7 +4610,8 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
     if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
         return false;
 
-    st = virStreamNew(ctl->conn, 0);
+    if (!(st = virStreamNew(ctl->conn, 0)))
+        goto cleanup;
 
     mime = virDomainScreenshot(dom, st, screen, flags);
     if (!mime) {
@@ -4620,7 +4621,7 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
 
     if (!file) {
         if (!(file=vshGenFileName(ctl, dom, mime)))
-            return false;
+            goto cleanup;
         generated = true;
     }
 
-- 
1.7.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]