mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
virhook: Resolve Coverity NULL_RETURNS
Coverity complains that many other callers to return err from virGetLastError() will check if err is not NULL before dereferencing it. Just do the same here for safety.
This commit is contained in:
parent
59802f23bc
commit
f7212f6bd3
@ -300,7 +300,8 @@ virHookCall(int driver,
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
/* Convert INTERNAL_ERROR into known error. */
|
/* Convert INTERNAL_ERROR into known error. */
|
||||||
virErrorPtr err = virGetLastError();
|
virErrorPtr err = virGetLastError();
|
||||||
virReportError(VIR_ERR_HOOK_SCRIPT_FAILED, "%s", err->message);
|
virReportError(VIR_ERR_HOOK_SCRIPT_FAILED, "%s",
|
||||||
|
err ? err->message : _("unknown error"));
|
||||||
}
|
}
|
||||||
|
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user