mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-23 06:23:10 +00:00
virsh: Resolve Coverity DEADCODE
Coverity points out that if 'dom' isn't returned from virDomainQemuAttach, then the code already jumps to cleanup, so there was no need for the subsequent if (dom != NULL) check. I moved the error message about failure into the goto cleanup on failure and then removed the if (dom != NULL) Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
a893b20eed
commit
60b029c7a0
@ -8498,17 +8498,15 @@ cmdQemuAttach(vshControl *ctl, const vshCmd *cmd)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dom = virDomainQemuAttach(ctl->conn, pid_value, flags)))
|
if (!(dom = virDomainQemuAttach(ctl->conn, pid_value, flags))) {
|
||||||
|
vshError(ctl, _("Failed to attach to pid %u"), pid_value);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (dom != NULL) {
|
|
||||||
vshPrint(ctl, _("Domain %s attached to pid %u\n"),
|
vshPrint(ctl, _("Domain %s attached to pid %u\n"),
|
||||||
virDomainGetName(dom), pid_value);
|
virDomainGetName(dom), pid_value);
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
ret = true;
|
ret = true;
|
||||||
} else {
|
|
||||||
vshError(ctl, _("Failed to attach to pid %u"), pid_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user