Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
tests/bhyveargv2xmltest.c | 16 +++++-----------
tests/bhyvexml2argvtest.c | 21 +++++++--------------
tests/bhyvexml2xmltest.c | 6 ++----
3 files changed, 14 insertions(+), 29 deletions(-)
diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c
index 735cc4b338..e58a36d17c 100644
--- a/tests/bhyveargv2xmltest.c
+++ b/tests/bhyveargv2xmltest.c
@@ -28,9 +28,9 @@ testCompareXMLToArgvFiles(const char *xmlfile,
unsigned int flags)
{
- char *actualxml = NULL;
- char *cmd = NULL;
- char *log = NULL;
+ g_autofree char *actualxml = NULL;
+ g_autofree char *cmd = NULL;
+ g_autofree char *log = NULL;
int ret = -1;
virDomainDefPtr vmdef = NULL;
@@ -86,9 +86,6 @@ testCompareXMLToArgvFiles(const char *xmlfile,
ret = 0;
fail:
- VIR_FREE(actualxml);
- VIR_FREE(cmd);
- VIR_FREE(log);
virDomainDefFree(vmdef);
return ret;
}
@@ -103,8 +100,8 @@ testCompareXMLToArgvHelper(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/bhyveargv2xmldata/bhyveargv2xml-%s.xml",
abs_srcdir, info->name);
@@ -112,9 +109,6 @@ testCompareXMLToArgvHelper(const void *data)
abs_srcdir, info->name);
result = testCompareXMLToArgvFiles(xml, args, info->flags);
-
- VIR_FREE(xml);
- VIR_FREE(args);
return result;
}
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index f7ae1db26d..ce2af08d4c 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -26,9 +26,9 @@ static int testCompareXMLToArgvFiles(const char *xml,
const char *dmcmdline,
unsigned int flags)
{
- char *actualargv = NULL;
- char *actualld = NULL;
- char *actualdm = NULL;
+ g_autofree char *actualargv = NULL;
+ g_autofree char *actualld = NULL;
+ g_autofree char *actualdm = NULL;
virDomainDefPtr vmdef = NULL;
virCommandPtr cmd = NULL;
virCommandPtr ldcmd = NULL;
@@ -99,9 +99,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
vmdef->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC)
virPortAllocatorRelease(vmdef->graphics[0]->data.vnc.port);
- VIR_FREE(actualargv);
- VIR_FREE(actualld);
- VIR_FREE(actualdm);
virCommandFree(cmd);
virCommandFree(ldcmd);
virDomainDefFree(vmdef);
@@ -119,10 +116,10 @@ testCompareXMLToArgvHelper(const void *data)
{
int ret = -1;
const struct testInfo *info = data;
- char *xml = NULL;
- char *args = NULL;
- char *ldargs = NULL;
- char *dmargs = NULL;
+ g_autofree char *xml = NULL;
+ g_autofree char *args = NULL;
+ g_autofree char *ldargs = NULL;
+ g_autofree char *dmargs = NULL;
xml = g_strdup_printf("%s/bhyvexml2argvdata/bhyvexml2argv-%s.xml",
abs_srcdir, info->name);
@@ -135,10 +132,6 @@ testCompareXMLToArgvHelper(const void *data)
ret = testCompareXMLToArgvFiles(xml, args, ldargs, dmargs, info->flags);
- VIR_FREE(xml);
- VIR_FREE(args);
- VIR_FREE(ldargs);
- VIR_FREE(dmargs);
return ret;
}
diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c
index a0c20a14c1..2ac102b8e3 100644
--- a/tests/bhyvexml2xmltest.c
+++ b/tests/bhyvexml2xmltest.c
@@ -26,8 +26,8 @@ static int
testCompareXMLToXMLHelper(const void *data)
{
const struct testInfo *info = data;
- char *xml_in = NULL;
- char *xml_out = NULL;
+ g_autofree char *xml_in = NULL;
+ g_autofree char *xml_out = NULL;
bool is_different = info->flags & FLAG_IS_DIFFERENT;
int ret = -1;
@@ -48,8 +48,6 @@ testCompareXMLToXMLHelper(const void *data)
virResetLastError();
}
- VIR_FREE(xml_in);
- VIR_FREE(xml_out);
return ret;
}
--
2.26.2