]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Validate arg in qemuAgentErrorComandUnsupported()
authorJonathon Jongsma <jjongsma@redhat.com>
Fri, 30 Aug 2019 16:09:09 +0000 (11:09 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 30 Aug 2019 21:23:03 +0000 (17:23 -0400)
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>
src/qemu/qemu_agent.c

index fddedf5cb67dba231910adb144b98a28e7b94410..34e1a85d6490ef3c64846f1ac93158b400a8d508 100644 (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;