From: Daniel P. Berrange Date: Wed, 25 Sep 2013 14:56:05 +0000 (+0100) Subject: Don't clobber 'ret' variable in testCompareXMLToXMLHelper X-Git-Tag: CVE-2013-4401~125 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=50ee3e03572567884692be5a4cfb08a8e616bef7;p=thirdparty%2Flibvirt.git Don't clobber 'ret' variable in testCompareXMLToXMLHelper The qemuxml2xmltest.c function testCompareXMLToXMLHelper would clobber the 'ret' variable causing it to mis-diagnose OOM errors. Signed-off-by: Daniel P. Berrange --- diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index c6615739b4..9fd3ada742 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);