Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- tests/vmx2xmltest.c | 13 ++++--------- tests/xml2vmxtest.c | 14 ++++---------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index 33bf243717..cd44a84a07 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -69,8 +69,8 @@ static int testCompareFiles(const char *vmx, const char *xml, bool should_fail_parse) { int ret = -1; - char *vmxData = NULL; - char *formatted = NULL; + g_autofree char *vmxData = NULL; + g_autofree char *formatted = NULL; virDomainDef *def = NULL; if (virTestLoadFile(vmx, &vmxData) < 0) @@ -102,8 +102,6 @@ testCompareFiles(const char *vmx, const char *xml, bool should_fail_parse) ret = 0; cleanup: - VIR_FREE(vmxData); - VIR_FREE(formatted); virDomainDefFree(def); return ret; @@ -119,8 +117,8 @@ testCompareHelper(const void *data) { int ret = -1; const struct testInfo *info = data; - char *vmx = NULL; - char *xml = NULL; + g_autofree char *vmx = NULL; + g_autofree char *xml = NULL; vmx = g_strdup_printf("%s/vmx2xmldata/%s.vmx", abs_srcdir, info->file); @@ -129,9 +127,6 @@ testCompareHelper(const void *data) ret = testCompareFiles(vmx, xml, info->should_fail); - VIR_FREE(vmx); - VIR_FREE(xml); - return ret; } diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index fb87000529..cb70f70f4f 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -71,7 +71,7 @@ static int testCompareFiles(const char *xml, const char *vmx, int virtualHW_version) { int result = -1; - char *formatted = NULL; + g_autofree char *formatted = NULL; virDomainDef *def = NULL; def = virDomainDefParseFile(xml, xmlopt, NULL, @@ -95,7 +95,6 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version) result = 0; failure: - VIR_FREE(formatted); virDomainDefFree(def); return result; @@ -112,8 +111,8 @@ testCompareHelper(const void *data) { int result = -1; const struct testInfo *info = data; - char *xml = NULL; - char *vmx = NULL; + g_autofree char *xml = NULL; + g_autofree char *vmx = NULL; xml = g_strdup_printf("%s/xml2vmxdata/xml2vmx-%s.xml", abs_srcdir, info->input); @@ -122,9 +121,6 @@ testCompareHelper(const void *data) result = testCompareFiles(xml, vmx, info->virtualHW_version); - VIR_FREE(xml); - VIR_FREE(vmx); - return result; } @@ -141,7 +137,7 @@ static char * testFormatVMXFileName(const char *src, void *opaque G_GNUC_UNUSED) { bool success = false; - char *copyOfDatastorePath = NULL; + g_autofree char *copyOfDatastorePath = NULL; char *tmp = NULL; char *saveptr = NULL; char *datastoreName = NULL; @@ -182,8 +178,6 @@ testFormatVMXFileName(const char *src, void *opaque G_GNUC_UNUSED) if (! success) VIR_FREE(absolutePath); - VIR_FREE(copyOfDatastorePath); - return absolutePath; } -- 2.31.1