]> xenbits.xensource.com Git - libvirt.git/commitdiff
Don't clobber 'ret' variable in testCompareXMLToXMLHelper
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 25 Sep 2013 14:56:05 +0000 (15:56 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 8 Oct 2013 11:39:30 +0000 (12:39 +0100)
The qemuxml2xmltest.c function testCompareXMLToXMLHelper would
clobber the 'ret' variable causing it to mis-diagnose OOM
errors.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tests/qemuxml2xmltest.c

index c6615739b47011c81f35f122bb66535a5ba2c5f9..9fd3ada7426cf777e71dcf597da301b6d629d29e 100644 (file)
@@ -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);