[PATCH 1/4] Don't clobber 'ret' variable in testCompareXMLToXMLHelper

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

The qemuxml2xmltest.c function testCompareXMLToXMLHelper would
clobber the 'ret' variable causing it to mis-diagnose OOM
errors.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 tests/qemuxml2xmltest.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index c661573..9fd3ada 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -84,16 +84,19 @@ testCompareXMLToXMLHelper(const void *data)
                     abs_srcdir, info->name) < 0)
         goto cleanup;
 
-    if (info->when & WHEN_INACTIVE) {
-        ret = testCompareXMLToXMLFiles(xml_in,
-                                       info->different ? xml_out : xml_in,
-                                       false);
-    }
-    if (info->when & WHEN_ACTIVE) {
-        ret = testCompareXMLToXMLFiles(xml_in,
-                                       info->different ? xml_out : xml_in,
-                                       true);
-    }
+    if ((info->when & WHEN_INACTIVE) &&
+        testCompareXMLToXMLFiles(xml_in,
+                                 info->different ? xml_out : xml_in,
+                                 false) < 0)
+        goto cleanup;
+
+    if ((info->when & WHEN_ACTIVE) &&
+        testCompareXMLToXMLFiles(xml_in,
+                                 info->different ? xml_out : xml_in,
+                                 true) < 0)
+        goto cleanup;
+
+    ret = 0;
 
 cleanup:
     VIR_FREE(xml_in);
-- 
1.8.3.1

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