[libvirt PATCH 3/3] ch: check return value of virJSONValueArrayAppend

Ján Tomko posted 3 patches 2 weeks, 2 days ago
There is a newer version of this series
[libvirt PATCH 3/3] ch: check return value of virJSONValueArrayAppend
Posted by Ján Tomko 2 weeks, 2 days ago
It only errors out when presented with a non-array, but we do check
it everywhere else.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/ch/ch_monitor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index 3e49902791..ccd04cfbd1 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -1002,7 +1002,8 @@ virCHMonitorBuildRestoreJson(virDomainDef *vmdef,
                 return -1;
             if (virJSONValueObjectAppendNumberInt(net_json, "num_fds", vmdef->nets[i]->driver.virtio.queues))
                 return -1;
-            virJSONValueArrayAppend(nets, &net_json);
+            if (virJSONValueArrayAppend(nets, &net_json) < 0)
+                return -1;
         }
         if (virJSONValueObjectAppend(restore_json, "net_fds", &nets))
             return -1;
-- 
2.47.0