qemu: Validate arg in qemuAgentErrorComandUnsupported()

Coverity noted that 'reply' can be NULL after calling
qemuAgentCommand().  Avoid dereferencing reply in
qemuAgentErrorComandUnsupported() in that case.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Jonathon Jongsma 2019-08-30 11:09:09 -05:00 committed by John Ferlan
parent 9a99b01f8d
commit be9d259ebc

View File

@ -1005,7 +1005,12 @@ static bool
qemuAgentErrorCommandUnsupported(virJSONValuePtr reply)
{
const char *klass;
virJSONValuePtr error = virJSONValueObjectGet(reply, "error");
virJSONValuePtr error;
if (!reply)
return false;
error = virJSONValueObjectGet(reply, "error");
if (!error)
return false;