Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
tests/cputest.c | 9 +++------
tests/domaincapstest.c | 6 ++----
tests/networkxml2conftest.c | 3 +--
tests/networkxml2xmltest.c | 3 +--
tests/vircapstest.c | 6 ++----
tests/virmacmaptest.c | 6 ++----
tests/virpcitest.c | 18 ++++++------------
tests/virresctrltest.c | 6 ++----
tests/virscsitest.c | 3 +--
tests/virusbtest.c | 3 +--
tests/xlconfigtest.c | 6 ++----
tests/xmconfigtest.c | 3 +--
12 files changed, 24 insertions(+), 48 deletions(-)
diff --git a/tests/cputest.c b/tests/cputest.c
index 3e99b9486b..11305d56c5 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -526,7 +526,7 @@ cpuTestCPUID(bool guest, const void *arg)
g_autofree char *host = NULL;
g_autoptr(virCPUDef) cpu = NULL;
g_autofree char *result = NULL;
- virDomainCapsCPUModels *models = NULL;
+ g_autoptr(virDomainCapsCPUModels) models = NULL;
hostFile = g_strdup_printf("%s/cputestdata/%s-cpuid-%s.xml", abs_srcdir,
virArchToString(data->arch), data->host);
@@ -563,7 +563,6 @@ cpuTestCPUID(bool guest, const void *arg)
ret = cpuTestCompareXML(data->arch, cpu, result);
cleanup:
- virObjectUnref(models);
return ret;
}
@@ -728,8 +727,8 @@ cpuTestUpdateLive(const void *arg)
g_autoptr(virCPUData) disabledData = NULL;
g_autofree char *expectedFile = NULL;
g_autoptr(virCPUDef) expected = NULL;
- virDomainCapsCPUModels *hvModels = NULL;
- virDomainCapsCPUModels *models = NULL;
+ g_autoptr(virDomainCapsCPUModels) hvModels = NULL;
+ g_autoptr(virDomainCapsCPUModels) models = NULL;
int ret = -1;
cpuFile = g_strdup_printf("cpuid-%s-guest", data->host);
@@ -795,8 +794,6 @@ cpuTestUpdateLive(const void *arg)
ret = cpuTestUpdateLiveCompare(data->arch, cpu, expected);
cleanup:
- virObjectUnref(hvModels);
- virObjectUnref(models);
return ret;
}
diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index ca29644dee..6ab14a0179 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -75,7 +75,7 @@ fillQemuCaps(virDomainCaps *domCaps,
{
int ret = -1;
char *path = NULL;
- virQEMUCaps *qemuCaps = NULL;
+ g_autoptr(virQEMUCaps) qemuCaps = NULL;
virDomainCapsLoader *loader = &domCaps->os.loader;
virDomainVirtType virtType;
@@ -127,7 +127,6 @@ fillQemuCaps(virDomainCaps *domCaps,
ret = 0;
cleanup:
- virObjectUnref(qemuCaps);
VIR_FREE(path);
return ret;
}
@@ -208,7 +207,7 @@ static int
test_virDomainCapsFormat(const void *opaque)
{
const struct testData *data = opaque;
- virDomainCaps *domCaps = NULL;
+ g_autoptr(virDomainCaps) domCaps = NULL;
char *path = NULL;
char *domCapsXML = NULL;
int ret = -1;
@@ -256,7 +255,6 @@ test_virDomainCapsFormat(const void *opaque)
cleanup:
VIR_FREE(domCapsXML);
VIR_FREE(path);
- virObjectUnref(domCaps);
return ret;
}
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index 7444390b77..a2ecc6e80a 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -27,7 +27,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
virCommand *cmd = NULL;
char *pidfile = NULL;
dnsmasqContext *dctx = NULL;
- virNetworkXMLOption *xmlopt = NULL;
+ g_autoptr(virNetworkXMLOption) xmlopt = NULL;
if (!(xmlopt = networkDnsmasqCreateXMLConf()))
goto fail;
@@ -85,7 +85,6 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
VIR_FREE(hostsfileactual);
VIR_FREE(pidfile);
virCommandFree(cmd);
- virObjectUnref(xmlopt);
virNetworkObjEndAPI(&obj);
dnsmasqContextFree(dctx);
return ret;
diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c
index 3b0a0b7c95..e1b5cdc748 100644
--- a/tests/networkxml2xmltest.c
+++ b/tests/networkxml2xmltest.c
@@ -30,7 +30,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
int ret;
testCompareNetXML2XMLResult result = TEST_COMPARE_NET_XML2XML_RESULT_SUCCESS;
virNetworkDef *dev = NULL;
- virNetworkXMLOption *xmlopt = NULL;
+ g_autoptr(virNetworkXMLOption) xmlopt = NULL;
if (!(xmlopt = networkDnsmasqCreateXMLConf()))
goto cleanup;
@@ -72,7 +72,6 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
VIR_FREE(actual);
virNetworkDefFree(dev);
- virObjectUnref(xmlopt);
return ret;
}
diff --git a/tests/vircapstest.c b/tests/vircapstest.c
index 7ec5b85222..ebabbbb9a0 100644
--- a/tests/vircapstest.c
+++ b/tests/vircapstest.c
@@ -151,7 +151,7 @@ static int
test_virCapsDomainDataLookupQEMU(const void *data G_GNUC_UNUSED)
{
int ret = 0;
- virCaps *caps = NULL;
+ g_autoptr(virCaps) caps = NULL;
if (!(caps = testQemuCapsInit())) {
ret = -1;
@@ -196,7 +196,6 @@ test_virCapsDomainDataLookupQEMU(const void *data G_GNUC_UNUSED)
CAPS_EXPECT_ERR(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_VMWARE, NULL, "pc");
out:
- virObjectUnref(caps);
return ret;
}
#endif /* WITH_QEMU */
@@ -206,7 +205,7 @@ static int
test_virCapsDomainDataLookupLXC(const void *data G_GNUC_UNUSED)
{
int ret = 0;
- virCaps *caps = NULL;
+ g_autoptr(virCaps) caps = NULL;
if (!(caps = testLXCCapsInit())) {
ret = -1;
@@ -221,7 +220,6 @@ test_virCapsDomainDataLookupLXC(const void *data G_GNUC_UNUSED)
VIR_DOMAIN_VIRT_LXC, "/usr/libexec/libvirt_lxc", NULL);
out:
- virObjectUnref(caps);
return ret;
}
#endif /* WITH_LXC */
diff --git a/tests/virmacmaptest.c b/tests/virmacmaptest.c
index 1b536af1ab..4e78615029 100644
--- a/tests/virmacmaptest.c
+++ b/tests/virmacmaptest.c
@@ -35,7 +35,7 @@ static int
testMACLookup(const void *opaque)
{
const struct testData *data = opaque;
- virMacMap *mgr = NULL;
+ g_autoptr(virMacMap) mgr = NULL;
GSList *macs;
GSList *next;
size_t i, j;
@@ -79,7 +79,6 @@ testMACLookup(const void *opaque)
ret = 0;
cleanup:
VIR_FREE(file);
- virObjectUnref(mgr);
return ret;
}
@@ -88,7 +87,7 @@ static int
testMACRemove(const void *opaque)
{
const struct testData *data = opaque;
- virMacMap *mgr = NULL;
+ g_autoptr(virMacMap) mgr = NULL;
GSList *macs;
size_t i;
char *file = NULL;
@@ -117,7 +116,6 @@ testMACRemove(const void *opaque)
ret = 0;
cleanup:
VIR_FREE(file);
- virObjectUnref(mgr);
return ret;
}
diff --git a/tests/virpcitest.c b/tests/virpcitest.c
index 0466e5a0f7..1cffe6e279 100644
--- a/tests/virpcitest.c
+++ b/tests/virpcitest.c
@@ -93,8 +93,8 @@ testVirPCIDeviceDetach(const void *opaque G_GNUC_UNUSED)
int ret = -1;
virPCIDevice *dev[] = {NULL, NULL, NULL};
size_t i, nDev = G_N_ELEMENTS(dev);
- virPCIDeviceList *activeDevs = NULL;
- virPCIDeviceList *inactiveDevs = NULL;
+ g_autoptr(virPCIDeviceList) activeDevs = NULL;
+ g_autoptr(virPCIDeviceList) inactiveDevs = NULL;
int count;
if (!(activeDevs = virPCIDeviceListNew()) ||
@@ -126,8 +126,6 @@ testVirPCIDeviceDetach(const void *opaque G_GNUC_UNUSED)
cleanup:
for (i = 0; i < nDev; i++)
virPCIDeviceFree(dev[i]);
- virObjectUnref(activeDevs);
- virObjectUnref(inactiveDevs);
return ret;
}
@@ -137,8 +135,8 @@ testVirPCIDeviceReset(const void *opaque G_GNUC_UNUSED)
int ret = -1;
virPCIDevice *dev[] = {NULL, NULL, NULL};
size_t i, nDev = G_N_ELEMENTS(dev);
- virPCIDeviceList *activeDevs = NULL;
- virPCIDeviceList *inactiveDevs = NULL;
+ g_autoptr(virPCIDeviceList) activeDevs = NULL;
+ g_autoptr(virPCIDeviceList) inactiveDevs = NULL;
int count;
if (!(activeDevs = virPCIDeviceListNew()) ||
@@ -164,8 +162,6 @@ testVirPCIDeviceReset(const void *opaque G_GNUC_UNUSED)
cleanup:
for (i = 0; i < nDev; i++)
virPCIDeviceFree(dev[i]);
- virObjectUnref(activeDevs);
- virObjectUnref(inactiveDevs);
return ret;
}
@@ -175,8 +171,8 @@ testVirPCIDeviceReattach(const void *opaque G_GNUC_UNUSED)
int ret = -1;
virPCIDevice *dev[] = {NULL, NULL, NULL};
size_t i, nDev = G_N_ELEMENTS(dev);
- virPCIDeviceList *activeDevs = NULL;
- virPCIDeviceList *inactiveDevs = NULL;
+ g_autoptr(virPCIDeviceList) activeDevs = NULL;
+ g_autoptr(virPCIDeviceList) inactiveDevs = NULL;
int count;
if (!(activeDevs = virPCIDeviceListNew()) ||
@@ -213,8 +209,6 @@ testVirPCIDeviceReattach(const void *opaque G_GNUC_UNUSED)
ret = 0;
cleanup:
- virObjectUnref(activeDevs);
- virObjectUnref(inactiveDevs);
return ret;
}
diff --git a/tests/virresctrltest.c b/tests/virresctrltest.c
index 26fbde3668..b1dbf66d41 100644
--- a/tests/virresctrltest.c
+++ b/tests/virresctrltest.c
@@ -21,10 +21,10 @@ test_virResctrlGetUnused(const void *opaque)
char *system_dir = NULL;
char *resctrl_dir = NULL;
int ret = -1;
- virResctrlAlloc *alloc = NULL;
+ g_autoptr(virResctrlAlloc) alloc = NULL;
char *schemata_str = NULL;
char *schemata_file;
- virCaps *caps = NULL;
+ g_autoptr(virCaps) caps = NULL;
system_dir = g_strdup_printf("%s/vircaps2xmldata/linux-%s/system",
abs_srcdir,
data->filename);
@@ -65,8 +65,6 @@ test_virResctrlGetUnused(const void *opaque)
ret = 0;
cleanup:
- virObjectUnref(caps);
- virObjectUnref(alloc);
VIR_FREE(system_dir);
VIR_FREE(resctrl_dir);
VIR_FREE(schemata_str);
diff --git a/tests/virscsitest.c b/tests/virscsitest.c
index 0d7c35a261..1b6a7b9ae9 100644
--- a/tests/virscsitest.c
+++ b/tests/virscsitest.c
@@ -60,7 +60,7 @@ test1(const void *data G_GNUC_UNUSED)
static int
test2(const void *data G_GNUC_UNUSED)
{
- virSCSIDeviceList *list = NULL;
+ g_autoptr(virSCSIDeviceList) list = NULL;
virSCSIDevice *dev = NULL;
virSCSIDevice *dev1 = NULL;
bool free_dev = true;
@@ -157,7 +157,6 @@ test2(const void *data G_GNUC_UNUSED)
virSCSIDeviceFree(dev);
if (free_dev1)
virSCSIDeviceFree(dev1);
- virObjectUnref(list);
return ret;
}
diff --git a/tests/virusbtest.c b/tests/virusbtest.c
index baad7dd821..39a8f1a18e 100644
--- a/tests/virusbtest.c
+++ b/tests/virusbtest.c
@@ -70,7 +70,7 @@ static int testDeviceFind(const void *opaque)
const struct findTestInfo *info = opaque;
int ret = -1;
virUSBDevice *dev = NULL;
- virUSBDeviceList *devs = NULL;
+ g_autoptr(virUSBDeviceList) devs = NULL;
int rv = 0;
size_t i, ndevs = 0;
@@ -123,7 +123,6 @@ static int testDeviceFind(const void *opaque)
ret = 0;
cleanup:
- virObjectUnref(devs);
virUSBDeviceFree(dev);
return ret;
}
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index e5c4a053bc..0a2997b8b6 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -67,7 +67,7 @@ testCompareParseXML(const char *xlcfg, const char *xml, bool
replaceVars)
{
char *gotxlcfgData = NULL;
g_autoptr(virConf) conf = NULL;
- virConnectPtr conn = NULL;
+ g_autoptr(virConnect) conn = NULL;
int wrote = 4096;
int ret = -1;
virDomainDef *def = NULL;
@@ -111,7 +111,6 @@ testCompareParseXML(const char *xlcfg, const char *xml, bool
replaceVars)
VIR_FREE(replacedXML);
VIR_FREE(gotxlcfgData);
virDomainDefFree(def);
- virObjectUnref(conn);
return ret;
}
@@ -127,7 +126,7 @@ testCompareFormatXML(const char *xlcfg, const char *xml, bool
replaceVars)
char *gotxml = NULL;
g_autoptr(virConf) conf = NULL;
int ret = -1;
- virConnectPtr conn;
+ g_autoptr(virConnect) conn = NULL;
virDomainDef *def = NULL;
char *replacedXML = NULL;
g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
@@ -166,7 +165,6 @@ testCompareFormatXML(const char *xlcfg, const char *xml, bool
replaceVars)
VIR_FREE(xlcfgData);
VIR_FREE(gotxml);
virDomainDefFree(def);
- virObjectUnref(conn);
return ret;
}
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index bf74e4a163..9d5eb85bf9 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -42,7 +42,7 @@ testCompareParseXML(const char *xmcfg, const char *xml)
char *gotxmcfgData = NULL;
g_autoptr(virConf) conf = NULL;
int ret = -1;
- virConnectPtr conn = NULL;
+ g_autoptr(virConnect) conn = NULL;
int wrote = 4096;
virDomainDef *def = NULL;
@@ -75,7 +75,6 @@ testCompareParseXML(const char *xmcfg, const char *xml)
fail:
VIR_FREE(gotxmcfgData);
virDomainDefFree(def);
- virObjectUnref(conn);
return ret;
}
--
2.31.1