#define PARSE(xml, var) \
do { \
int rc; \
- xmlDocPtr doc; \
- xmlXPathContextPtr ctxt = NULL; \
+ g_autoptr(xmlDoc) doc = NULL; \
+ g_autoptr(xmlXPathContext) ctxt = NULL; \
\
if (!xml) \
break; \
NULL, \
ctxt->node, \
true); \
- xmlFreeDoc(doc); \
- xmlXPathFreeContext(ctxt); \
if (rc < 0) \
goto cleanup; \
} while (0)
const char *iface = info->iface;
g_autoptr(virNetDevBandwidth) band = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- char *actual_cmd = NULL;
+ g_autofree char *actual_cmd = NULL;
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
PARSE(info->band, band);
ret = 0;
cleanup:
- VIR_FREE(actual_cmd);
return ret;
}
int ret = -1;
const struct testClearQosStruct *info = data;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- char *actual_cmd = NULL;
+ g_autofree char *actual_cmd = NULL;
const char *iface = info->iface;
const unsigned char *vmid = info->vmid;
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
ret = 0;
cleanup:
- VIR_FREE(actual_cmd);
return ret;
}