mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-30 11:25:47 +00:00
tests: vmx: use g_autofree
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
f657b02ce3
commit
5679b6283b
@ -69,8 +69,8 @@ static int
|
|||||||
testCompareFiles(const char *vmx, const char *xml, bool should_fail_parse)
|
testCompareFiles(const char *vmx, const char *xml, bool should_fail_parse)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *vmxData = NULL;
|
g_autofree char *vmxData = NULL;
|
||||||
char *formatted = NULL;
|
g_autofree char *formatted = NULL;
|
||||||
virDomainDef *def = NULL;
|
virDomainDef *def = NULL;
|
||||||
|
|
||||||
if (virTestLoadFile(vmx, &vmxData) < 0)
|
if (virTestLoadFile(vmx, &vmxData) < 0)
|
||||||
@ -102,8 +102,6 @@ testCompareFiles(const char *vmx, const char *xml, bool should_fail_parse)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(vmxData);
|
|
||||||
VIR_FREE(formatted);
|
|
||||||
virDomainDefFree(def);
|
virDomainDefFree(def);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -119,8 +117,8 @@ testCompareHelper(const void *data)
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
const struct testInfo *info = data;
|
const struct testInfo *info = data;
|
||||||
char *vmx = NULL;
|
g_autofree char *vmx = NULL;
|
||||||
char *xml = NULL;
|
g_autofree char *xml = NULL;
|
||||||
|
|
||||||
vmx = g_strdup_printf("%s/vmx2xmldata/%s.vmx", abs_srcdir,
|
vmx = g_strdup_printf("%s/vmx2xmldata/%s.vmx", abs_srcdir,
|
||||||
info->file);
|
info->file);
|
||||||
@ -129,9 +127,6 @@ testCompareHelper(const void *data)
|
|||||||
|
|
||||||
ret = testCompareFiles(vmx, xml, info->should_fail);
|
ret = testCompareFiles(vmx, xml, info->should_fail);
|
||||||
|
|
||||||
VIR_FREE(vmx);
|
|
||||||
VIR_FREE(xml);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ static int
|
|||||||
testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
|
testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
|
||||||
{
|
{
|
||||||
int result = -1;
|
int result = -1;
|
||||||
char *formatted = NULL;
|
g_autofree char *formatted = NULL;
|
||||||
virDomainDef *def = NULL;
|
virDomainDef *def = NULL;
|
||||||
|
|
||||||
def = virDomainDefParseFile(xml, xmlopt, NULL,
|
def = virDomainDefParseFile(xml, xmlopt, NULL,
|
||||||
@ -95,7 +95,6 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
|
|||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
failure:
|
failure:
|
||||||
VIR_FREE(formatted);
|
|
||||||
virDomainDefFree(def);
|
virDomainDefFree(def);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -112,8 +111,8 @@ testCompareHelper(const void *data)
|
|||||||
{
|
{
|
||||||
int result = -1;
|
int result = -1;
|
||||||
const struct testInfo *info = data;
|
const struct testInfo *info = data;
|
||||||
char *xml = NULL;
|
g_autofree char *xml = NULL;
|
||||||
char *vmx = NULL;
|
g_autofree char *vmx = NULL;
|
||||||
|
|
||||||
xml = g_strdup_printf("%s/xml2vmxdata/xml2vmx-%s.xml", abs_srcdir,
|
xml = g_strdup_printf("%s/xml2vmxdata/xml2vmx-%s.xml", abs_srcdir,
|
||||||
info->input);
|
info->input);
|
||||||
@ -122,9 +121,6 @@ testCompareHelper(const void *data)
|
|||||||
|
|
||||||
result = testCompareFiles(xml, vmx, info->virtualHW_version);
|
result = testCompareFiles(xml, vmx, info->virtualHW_version);
|
||||||
|
|
||||||
VIR_FREE(xml);
|
|
||||||
VIR_FREE(vmx);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +137,7 @@ static char *
|
|||||||
testFormatVMXFileName(const char *src, void *opaque G_GNUC_UNUSED)
|
testFormatVMXFileName(const char *src, void *opaque G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
char *copyOfDatastorePath = NULL;
|
g_autofree char *copyOfDatastorePath = NULL;
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
char *saveptr = NULL;
|
char *saveptr = NULL;
|
||||||
char *datastoreName = NULL;
|
char *datastoreName = NULL;
|
||||||
@ -182,8 +178,6 @@ testFormatVMXFileName(const char *src, void *opaque G_GNUC_UNUSED)
|
|||||||
if (! success)
|
if (! success)
|
||||||
VIR_FREE(absolutePath);
|
VIR_FREE(absolutePath);
|
||||||
|
|
||||||
VIR_FREE(copyOfDatastorePath);
|
|
||||||
|
|
||||||
return absolutePath;
|
return absolutePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user