[PATCH 1/3] virsh-domain: Report errors and don't deref NULL in qemu-agent-command

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

 



Check the returned value for NULL and take the cleanup path
appropriately if the API fails.
---
 tools/virsh-domain.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 46f07ed..9ea5ffc 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -7739,7 +7739,10 @@ cmdQemuAgentCommand(vshControl *ctl, const vshCmd *cmd)
         vshError(ctl, "%s", _("timeout, async and block options are exclusive"));
         goto cleanup;
     }
+
     result = virDomainQemuAgentCommand(dom, guest_agent_cmd, timeout, flags);
+    if (!result)
+        goto cleanup;

     if (vshCommandOptBool(cmd, "pretty")) {
         char *tmp;
-- 
1.8.2.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]