]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh-domain: Report errors and don't deref NULL in qemu-agent-command
authorPeter Krempa <pkrempa@redhat.com>
Mon, 3 Jun 2013 13:42:26 +0000 (15:42 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 3 Jun 2013 15:25:26 +0000 (17:25 +0200)
Check the returned value for NULL and take the cleanup path
appropriately if the API fails.

tools/virsh-domain.c

index 46f07edc72910582c5e26ea54083b30816f6bd09..9ea5ffc97ecb61eee5a1ca035fb971c3b5ac7bee 100644 (file)
@@ -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;