[PATCH v2 5/10] util: Need to check child JSON allocation before use

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

 



---
 src/util/virlockspace.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c
index 163404f..4ff0f3a 100644
--- a/src/util/virlockspace.c
+++ b/src/util/virlockspace.c
@@ -459,8 +459,10 @@ virJSONValuePtr virLockSpacePreExecRestart(virLockSpacePtr lockspace)
     virJSONValuePtr resources;
     virHashKeyValuePairPtr pairs = NULL, tmp;
 
-    if (!object)
+    if (!object) {
+        virReportOOMError();
         return NULL;
+    }
 
     virMutexLock(&lockspace->lock);
 
@@ -483,6 +485,11 @@ virJSONValuePtr virLockSpacePreExecRestart(virLockSpacePtr lockspace)
         virJSONValuePtr owners = NULL;
         size_t i;
 
+        if (!child) {
+            virReportOOMError();
+            goto error;
+        }
+
         if (virJSONValueArrayAppend(resources, child) < 0) {
             virJSONValueFree(child);
             goto error;
-- 
1.7.11.7

--
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]