Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
tests/domainconftest.c | 3 +--
tests/libxlxml2domconfigtest.c | 3 +--
tests/lxcconf2xmltest.c | 3 +--
tests/openvzutilstest.c | 3 +--
tests/qemuagenttest.c | 3 +--
tests/securityselinuxlabeltest.c | 3 +--
tests/testutils.c | 3 +--
tests/vmx2xmltest.c | 3 +--
tests/xlconfigtest.c | 6 ++----
tests/xmconfigtest.c | 6 ++----
tests/xml2vmxtest.c | 3 +--
11 files changed, 13 insertions(+), 26 deletions(-)
diff --git a/tests/domainconftest.c b/tests/domainconftest.c
index 8b77952860..aaf58bcf93 100644
--- a/tests/domainconftest.c
+++ b/tests/domainconftest.c
@@ -41,7 +41,7 @@ struct testGetFilesystemData {
static int testGetFilesystem(const void *opaque)
{
int ret = -1;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
g_autofree char *filename = NULL;
const struct testGetFilesystemData *data = opaque;
virDomainFSDef *fsdef;
@@ -71,7 +71,6 @@ static int testGetFilesystem(const void *opaque)
ret = 0;
cleanup:
- virDomainDefFree(def);
return ret;
}
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index 2bc5c26223..015597eb44 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -52,7 +52,7 @@ testCompareXMLToDomConfig(const char *xmlfile,
libxl_domain_config expectconfig;
xentoollog_logger *log = NULL;
virPortAllocatorRange *gports = NULL;
- virDomainDef *vmdef = NULL;
+ g_autoptr(virDomainDef) vmdef = NULL;
g_autofree char *actualjson = NULL;
g_autofree char *tempjson = NULL;
g_autofree char *expectjson = NULL;
@@ -128,7 +128,6 @@ testCompareXMLToDomConfig(const char *xmlfile,
vmdef->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC)
virPortAllocatorRelease(vmdef->graphics[0]->data.vnc.port);
- virDomainDefFree(vmdef);
virPortAllocatorRangeFree(gports);
libxl_domain_config_dispose(&actualconfig);
libxl_domain_config_dispose(&expectconfig);
diff --git a/tests/lxcconf2xmltest.c b/tests/lxcconf2xmltest.c
index 99473a0b89..be70671d68 100644
--- a/tests/lxcconf2xmltest.c
+++ b/tests/lxcconf2xmltest.c
@@ -28,7 +28,7 @@ testCompareXMLToConfigFiles(const char *xmlfile,
int ret = -1;
g_autofree char *config = NULL;
g_autofree char *actualxml = NULL;
- virDomainDef *vmdef = NULL;
+ g_autoptr(virDomainDef) vmdef = NULL;
if (virTestLoadFile(configfile, &config) < 0)
goto fail;
@@ -51,7 +51,6 @@ testCompareXMLToConfigFiles(const char *xmlfile,
ret = 0;
fail:
- virDomainDefFree(vmdef);
return ret;
}
diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c
index 10cf307d61..3ebf38f104 100644
--- a/tests/openvzutilstest.c
+++ b/tests/openvzutilstest.c
@@ -69,7 +69,7 @@ static int
testReadNetworkConf(const void *data G_GNUC_UNUSED)
{
int result = -1;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
g_autofree char *actual = NULL;
const char *expected =
"<domain type='openvz'>\n"
@@ -131,7 +131,6 @@ testReadNetworkConf(const void *data G_GNUC_UNUSED)
cleanup:
virObjectUnref(driver.xmlopt);
virObjectUnref(driver.caps);
- virDomainDefFree(def);
return result;
}
diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index a447c93494..10d02bd1b4 100644
--- a/tests/qemuagenttest.c
+++ b/tests/qemuagenttest.c
@@ -313,7 +313,7 @@ testQemuAgentGetFSInfo(const void *data)
{
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
qemuMonitorTest *test = NULL;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
qemuAgentFSInfo **info = NULL;
int ret = -1, ninfo = 0, i;
@@ -405,7 +405,6 @@ testQemuAgentGetFSInfo(const void *data)
for (i = 0; i < ninfo; i++)
qemuAgentFSInfoFree(info[i]);
VIR_FREE(info);
- virDomainDefFree(def);
qemuMonitorTestFree(test);
return ret;
}
diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c
index 2fb6e0c6b7..2e5941d7ef 100644
--- a/tests/securityselinuxlabeltest.c
+++ b/tests/securityselinuxlabeltest.c
@@ -278,7 +278,7 @@ testSELinuxLabeling(const void *opaque)
testSELinuxFile *files = NULL;
size_t nfiles = 0;
size_t i;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
if (testSELinuxLoadFileList(testname, &files, &nfiles) < 0)
goto cleanup;
@@ -301,7 +301,6 @@ testSELinuxLabeling(const void *opaque)
if (testSELinuxDeleteDisks(files, nfiles) < 0)
VIR_WARN("unable to fully clean up");
- virDomainDefFree(def);
for (i = 0; i < nfiles; i++) {
VIR_FREE(files[i].file);
VIR_FREE(files[i].context);
diff --git a/tests/testutils.c b/tests/testutils.c
index d98246ec75..7e0d273ed4 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -1009,7 +1009,7 @@ testCompareDomXML2XMLFiles(virCaps *caps G_GNUC_UNUSED,
g_autofree char *actual = NULL;
int ret = -1;
testCompareDomXML2XMLResult result;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
unsigned int parse_flags = live ? 0 : VIR_DOMAIN_DEF_PARSE_INACTIVE;
unsigned int format_flags = VIR_DOMAIN_DEF_FORMAT_SECURE;
@@ -1059,7 +1059,6 @@ testCompareDomXML2XMLFiles(virCaps *caps G_GNUC_UNUSED,
expectResult, result);
}
- virDomainDefFree(def);
return ret;
}
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index cd44a84a07..b7f232eb77 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -71,7 +71,7 @@ testCompareFiles(const char *vmx, const char *xml, bool
should_fail_parse)
int ret = -1;
g_autofree char *vmxData = NULL;
g_autofree char *formatted = NULL;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
if (virTestLoadFile(vmx, &vmxData) < 0)
return -1;
@@ -102,7 +102,6 @@ testCompareFiles(const char *vmx, const char *xml, bool
should_fail_parse)
ret = 0;
cleanup:
- virDomainDefFree(def);
return ret;
}
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 95ee670b00..6717377982 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -69,7 +69,7 @@ testCompareParseXML(const char *xlcfg, const char *xml, bool
replaceVars)
g_autoptr(virConnect) conn = NULL;
int wrote = 4096;
int ret = -1;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
g_autofree char *replacedXML = NULL;
gotxlcfgData = g_new0(char, wrote);
@@ -107,7 +107,6 @@ testCompareParseXML(const char *xlcfg, const char *xml, bool
replaceVars)
ret = 0;
fail:
- virDomainDefFree(def);
return ret;
}
@@ -124,7 +123,7 @@ testCompareFormatXML(const char *xlcfg, const char *xml, bool
replaceVars)
g_autoptr(virConf) conf = NULL;
int ret = -1;
g_autoptr(virConnect) conn = NULL;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
g_autofree char *replacedXML = NULL;
g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
@@ -158,7 +157,6 @@ testCompareFormatXML(const char *xlcfg, const char *xml, bool
replaceVars)
ret = 0;
fail:
- virDomainDefFree(def);
return ret;
}
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index a756f752f8..bd23e5fd5d 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -44,7 +44,7 @@ testCompareParseXML(const char *xmcfg, const char *xml)
int ret = -1;
g_autoptr(virConnect) conn = NULL;
int wrote = 4096;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
gotxmcfgData = g_new0(char, wrote);
@@ -73,7 +73,6 @@ testCompareParseXML(const char *xmcfg, const char *xml)
ret = 0;
fail:
- virDomainDefFree(def);
return ret;
}
@@ -85,7 +84,7 @@ testCompareFormatXML(const char *xmcfg, const char *xml)
g_autofree char *gotxml = NULL;
g_autoptr(virConf) conf = NULL;
int ret = -1;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
if (virTestLoadFile(xmcfg, &xmcfgData) < 0)
@@ -106,7 +105,6 @@ testCompareFormatXML(const char *xmcfg, const char *xml)
ret = 0;
fail:
- virDomainDefFree(def);
return ret;
}
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index cb70f70f4f..8a03237b16 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -72,7 +72,7 @@ testCompareFiles(const char *xml, const char *vmx, int
virtualHW_version)
{
int result = -1;
g_autofree char *formatted = NULL;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
def = virDomainDefParseFile(xml, xmlopt, NULL,
VIR_DOMAIN_DEF_PARSE_INACTIVE);
@@ -95,7 +95,6 @@ testCompareFiles(const char *xml, const char *vmx, int
virtualHW_version)
result = 0;
failure:
- virDomainDefFree(def);
return result;
}
--
2.31.1