const char *stateDir,
const char *name)
{
- char *stateFile = NULL;
+ g_autofree char *stateFile = NULL;
virStoragePoolObj *obj = NULL;
g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
obj->active = true;
cleanup:
- VIR_FREE(stateFile);
return obj;
}
static virCPUDef *
cpuTestLoadXML(virArch arch, const char *name)
{
- char *xml = NULL;
+ g_autofree char *xml = NULL;
g_autoptr(xmlDoc) doc = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
virCPUDef *cpu = NULL;
virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_AUTO, &cpu, false);
cleanup:
- VIR_FREE(xml);
return cpu;
}
const char *name,
unsigned int *count)
{
- char *xml = NULL;
+ g_autofree char *xml = NULL;
g_autoptr(xmlDoc) doc = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
- xmlNodePtr *nodes = NULL;
+ g_autofree xmlNodePtr *nodes = NULL;
virCPUDef **cpus = NULL;
int n;
size_t i;
*count = n;
cleanup:
- VIR_FREE(xml);
- VIR_FREE(nodes);
return cpus;
cleanup_cpus:
g_autoptr(xmlXPathContext) ctxt = NULL;
xmlNodePtr node;
- char *xml = NULL;
+ g_autofree char *xml = NULL;
char *ret = NULL;
if (!(xml = virDomainGetXMLDesc(dom, 0)))
ret = virXMLNodeToString(node->doc, node);
cleanup:
- VIR_FREE(xml);
return ret;
}