From be9d259ebc6d67430cd6e9bd43a91ac55a7903e0 Mon Sep 17 00:00:00 2001 From: Jonathon Jongsma Date: Fri, 30 Aug 2019 11:09:09 -0500 Subject: [PATCH] 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 --- src/qemu/qemu_agent.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- 2.47.2