virsh-domain: Report errors and don't deref NULL in qemu-agent-command

Check the returned value for NULL and take the cleanup path
appropriately if the API fails.
This commit is contained in:
Peter Krempa 2013-06-03 15:42:26 +02:00
parent cdd642ba5e
commit 08f1c0a9ae

View File

@ -7739,7 +7739,10 @@ cmdQemuAgentCommand(vshControl *ctl, const vshCmd *cmd)
vshError(ctl, "%s", _("timeout, async and block options are exclusive")); vshError(ctl, "%s", _("timeout, async and block options are exclusive"));
goto cleanup; goto cleanup;
} }
result = virDomainQemuAgentCommand(dom, guest_agent_cmd, timeout, flags); result = virDomainQemuAgentCommand(dom, guest_agent_cmd, timeout, flags);
if (!result)
goto cleanup;
if (vshCommandOptBool(cmd, "pretty")) { if (vshCommandOptBool(cmd, "pretty")) {
char *tmp; char *tmp;