Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
tests/networkxml2conftest.c | 16 +++++-----------
tests/networkxml2firewalltest.c | 9 +++------
tests/networkxml2xmltest.c | 10 +++-------
tests/networkxml2xmlupdatetest.c | 16 +++++-----------
4 files changed, 16 insertions(+), 35 deletions(-)
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index a2ecc6e80a..b76d72793a 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -20,12 +20,12 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
char *outhostsfile, dnsmasqCaps *caps)
{
char *confactual = NULL;
- char *hostsfileactual = NULL;
+ g_autofree char *hostsfileactual = NULL;
int ret = -1;
virNetworkDef *def = NULL;
virNetworkObj *obj = NULL;
virCommand *cmd = NULL;
- char *pidfile = NULL;
+ g_autofree char *pidfile = NULL;
dnsmasqContext *dctx = NULL;
g_autoptr(virNetworkXMLOption) xmlopt = NULL;
@@ -82,8 +82,6 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
fail:
VIR_FREE(confactual);
- VIR_FREE(hostsfileactual);
- VIR_FREE(pidfile);
virCommandFree(cmd);
virNetworkObjEndAPI(&obj);
dnsmasqContextFree(dctx);
@@ -100,9 +98,9 @@ testCompareXMLToConfHelper(const void *data)
{
int result = -1;
const testInfo *info = data;
- char *inxml = NULL;
- char *outconf = NULL;
- char *outhostsfile = NULL;
+ g_autofree char *inxml = NULL;
+ g_autofree char *outconf = NULL;
+ g_autofree char *outhostsfile = NULL;
inxml = g_strdup_printf("%s/networkxml2confdata/%s.xml", abs_srcdir,
info->name);
outconf = g_strdup_printf("%s/networkxml2confdata/%s.conf", abs_srcdir,
info->name);
@@ -110,10 +108,6 @@ testCompareXMLToConfHelper(const void *data)
result = testCompareXMLToConfFiles(inxml, outconf, outhostsfile, info->caps);
- VIR_FREE(inxml);
- VIR_FREE(outconf);
- VIR_FREE(outhostsfile);
-
return result;
}
diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltest.c
index 91336a0c55..e4f86bc3fc 100644
--- a/tests/networkxml2firewalltest.c
+++ b/tests/networkxml2firewalltest.c
@@ -91,7 +91,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
const char *cmdline,
const char *baseargs)
{
- char *actualargv = NULL;
+ g_autofree char *actualargv = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virNetworkDef *def = NULL;
int ret = -1;
@@ -121,7 +121,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
ret = 0;
cleanup:
- VIR_FREE(actualargv);
virNetworkDefFree(def);
return ret;
}
@@ -137,8 +136,8 @@ testCompareXMLToIPTablesHelper(const void *data)
{
int result = -1;
const struct testInfo *info = data;
- char *xml = NULL;
- char *args = NULL;
+ g_autofree char *xml = NULL;
+ g_autofree char *args = NULL;
xml = g_strdup_printf("%s/networkxml2firewalldata/%s.xml",
abs_srcdir, info->name);
@@ -147,8 +146,6 @@ testCompareXMLToIPTablesHelper(const void *data)
result = testCompareXMLToArgvFiles(xml, args, info->baseargs);
- VIR_FREE(xml);
- VIR_FREE(args);
return result;
}
diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c
index e1b5cdc748..ca24305ace 100644
--- a/tests/networkxml2xmltest.c
+++ b/tests/networkxml2xmltest.c
@@ -26,7 +26,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
unsigned int flags,
testCompareNetXML2XMLResult expectResult)
{
- char *actual = NULL;
+ g_autofree char *actual = NULL;
int ret;
testCompareNetXML2XMLResult result = TEST_COMPARE_NET_XML2XML_RESULT_SUCCESS;
virNetworkDef *dev = NULL;
@@ -70,7 +70,6 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
}
virResetLastError();
- VIR_FREE(actual);
virNetworkDefFree(dev);
return ret;
}
@@ -86,8 +85,8 @@ testCompareXMLToXMLHelper(const void *data)
{
const struct testInfo *info = data;
int result = -1;
- char *inxml = NULL;
- char *outxml = NULL;
+ g_autofree char *inxml = NULL;
+ g_autofree char *outxml = NULL;
inxml = g_strdup_printf("%s/networkxml2xmlin/%s.xml", abs_srcdir,
info->name);
outxml = g_strdup_printf("%s/networkxml2xmlout/%s.xml", abs_srcdir,
info->name);
@@ -95,9 +94,6 @@ testCompareXMLToXMLHelper(const void *data)
result = testCompareXMLToXMLFiles(inxml, outxml, info->flags,
info->expectResult);
- VIR_FREE(inxml);
- VIR_FREE(outxml);
-
return result;
}
diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatetest.c
index 11cfdfc25e..4471b4dd9e 100644
--- a/tests/networkxml2xmlupdatetest.c
+++ b/tests/networkxml2xmlupdatetest.c
@@ -19,8 +19,8 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
unsigned int command, unsigned int section,
int parentIndex, bool expectFailure)
{
- char *updateXmlData = NULL;
- char *actual = NULL;
+ g_autofree char *updateXmlData = NULL;
+ g_autofree char *actual = NULL;
int ret = -1;
virNetworkDef *def = NULL;
@@ -55,8 +55,6 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
}
}
error:
- VIR_FREE(updateXmlData);
- VIR_FREE(actual);
virNetworkDefFree(def);
return ret;
}
@@ -78,9 +76,9 @@ testCompareXMLToXMLHelper(const void *data)
{
const struct testInfo *info = data;
int result = -1;
- char *netxml = NULL;
- char *updatexml = NULL;
- char *outxml = NULL;
+ g_autofree char *netxml = NULL;
+ g_autofree char *updatexml = NULL;
+ g_autofree char *outxml = NULL;
netxml = g_strdup_printf("%s/networkxml2xmlin/%s.xml",
abs_srcdir, info->netxml);
@@ -93,10 +91,6 @@ testCompareXMLToXMLHelper(const void *data)
info->command, info->section,
info->parentIndex, info->expectFailure);
- VIR_FREE(netxml);
- VIR_FREE(updatexml);
- VIR_FREE(outxml);
-
return result;
}
--
2.31.1