From: Jonathon Jongsma Date: Fri, 30 Aug 2019 16:09:09 +0000 (-0500) Subject: qemu: Validate arg in qemuAgentErrorComandUnsupported() X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=be9d259ebc6d67430cd6e9bd43a91ac55a7903e0;p=libvirt.git 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 --- diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index fddedf5cb6..34e1a85d64 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -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;