[libvirt PATCH 2/3] util: json: check return value of virJSONValueFromJsonC

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

 



In virJSONValueFromJsonC, the return value of virJSONValueFromJsonC
was not checked in one case.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/util/virjson.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/util/virjson.c b/src/util/virjson.c
index 18a4585e7b..a799707c16 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -1437,6 +1437,11 @@ virJSONValueFromJsonC(json_object *jobj)
 
             cur = virJSONValueFromJsonC(val);
 
+            if (!cur) {
+                g_free(ret);
+                return NULL;
+            }
+
             virJSONValueArrayAppend(ret, &cur);
         }
         break;
-- 
2.47.0




[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