[libvirt PATCH] qemu: Check return value of virJSONValueObjectAdd

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

 



The return value was not properly checked in the code for input type
evdev.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 45278c7108..483041f584 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4336,13 +4336,15 @@ qemuBuildInputEvdevProps(virDomainInputDef *dev)
                                      NULL) < 0)
         return NULL;
 
-    if (dev->source.grab == VIR_DOMAIN_INPUT_SOURCE_GRAB_ALL)
-        virJSONValueObjectAdd(props, "b:grab_all", true, NULL);
+    if (dev->source.grab == VIR_DOMAIN_INPUT_SOURCE_GRAB_ALL &&
+        virJSONValueObjectAdd(props, "b:grab_all", true, NULL) < 0)
+        return NULL;
 
-    if (dev->source.grabToggle != VIR_DOMAIN_INPUT_SOURCE_GRAB_TOGGLE_DEFAULT)
+    if (dev->source.grabToggle != VIR_DOMAIN_INPUT_SOURCE_GRAB_TOGGLE_DEFAULT &&
         virJSONValueObjectAdd(props, "s:grab-toggle",
                               virDomainInputSourceGrabToggleTypeToString(dev->source.grabToggle),
-                              NULL);
+                              NULL) < 0)
+        return NULL;
 
     return g_steal_pointer(&props);
 }
-- 
2.33.1




[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