static int testGetFilesystem(const void *opaque)
{
int ret = -1;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
g_autofree char *filename = NULL;
const struct testGetFilesystemData *data = opaque;
virDomainFSDef *fsdef;
ret = 0;
cleanup:
- virDomainDefFree(def);
return ret;
}
libxl_domain_config expectconfig;
xentoollog_logger *log = NULL;
virPortAllocatorRange *gports = NULL;
- virDomainDef *vmdef = NULL;
+ g_autoptr(virDomainDef) vmdef = NULL;
g_autofree char *actualjson = NULL;
g_autofree char *tempjson = NULL;
g_autofree char *expectjson = NULL;
vmdef->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC)
virPortAllocatorRelease(vmdef->graphics[0]->data.vnc.port);
- virDomainDefFree(vmdef);
virPortAllocatorRangeFree(gports);
libxl_domain_config_dispose(&actualconfig);
libxl_domain_config_dispose(&expectconfig);
int ret = -1;
g_autofree char *config = NULL;
g_autofree char *actualxml = NULL;
- virDomainDef *vmdef = NULL;
+ g_autoptr(virDomainDef) vmdef = NULL;
if (virTestLoadFile(configfile, &config) < 0)
goto fail;
ret = 0;
fail:
- virDomainDefFree(vmdef);
return ret;
}
testReadNetworkConf(const void *data G_GNUC_UNUSED)
{
int result = -1;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
g_autofree char *actual = NULL;
const char *expected =
"<domain type='openvz'>\n"
cleanup:
virObjectUnref(driver.xmlopt);
virObjectUnref(driver.caps);
- virDomainDefFree(def);
return result;
}
{
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
qemuMonitorTest *test = NULL;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
qemuAgentFSInfo **info = NULL;
int ret = -1, ninfo = 0, i;
for (i = 0; i < ninfo; i++)
qemuAgentFSInfoFree(info[i]);
VIR_FREE(info);
- virDomainDefFree(def);
qemuMonitorTestFree(test);
return ret;
}
testSELinuxFile *files = NULL;
size_t nfiles = 0;
size_t i;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
if (testSELinuxLoadFileList(testname, &files, &nfiles) < 0)
goto cleanup;
if (testSELinuxDeleteDisks(files, nfiles) < 0)
VIR_WARN("unable to fully clean up");
- virDomainDefFree(def);
for (i = 0; i < nfiles; i++) {
VIR_FREE(files[i].file);
VIR_FREE(files[i].context);
g_autofree char *actual = NULL;
int ret = -1;
testCompareDomXML2XMLResult result;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
unsigned int parse_flags = live ? 0 : VIR_DOMAIN_DEF_PARSE_INACTIVE;
unsigned int format_flags = VIR_DOMAIN_DEF_FORMAT_SECURE;
expectResult, result);
}
- virDomainDefFree(def);
return ret;
}
int ret = -1;
g_autofree char *vmxData = NULL;
g_autofree char *formatted = NULL;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
if (virTestLoadFile(vmx, &vmxData) < 0)
return -1;
ret = 0;
cleanup:
- virDomainDefFree(def);
return ret;
}
g_autoptr(virConnect) conn = NULL;
int wrote = 4096;
int ret = -1;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
g_autofree char *replacedXML = NULL;
gotxlcfgData = g_new0(char, wrote);
ret = 0;
fail:
- virDomainDefFree(def);
return ret;
}
g_autoptr(virConf) conf = NULL;
int ret = -1;
g_autoptr(virConnect) conn = NULL;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
g_autofree char *replacedXML = NULL;
g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
ret = 0;
fail:
- virDomainDefFree(def);
return ret;
}
int ret = -1;
g_autoptr(virConnect) conn = NULL;
int wrote = 4096;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
gotxmcfgData = g_new0(char, wrote);
ret = 0;
fail:
- virDomainDefFree(def);
return ret;
}
g_autofree char *gotxml = NULL;
g_autoptr(virConf) conf = NULL;
int ret = -1;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
if (virTestLoadFile(xmcfg, &xmcfgData) < 0)
ret = 0;
fail:
- virDomainDefFree(def);
return ret;
}
{
int result = -1;
g_autofree char *formatted = NULL;
- virDomainDef *def = NULL;
+ g_autoptr(virDomainDef) def = NULL;
def = virDomainDefParseFile(xml, xmlopt, NULL,
VIR_DOMAIN_DEF_PARSE_INACTIVE);
result = 0;
failure:
- virDomainDefFree(def);
return result;
}