[PATCH] qemu: Validate arg in qemuAgentErrorComandUnsupported()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
---
 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.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux