1
0

tests: virnetdevopenvswitch: use g_auto

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2021-08-20 14:43:29 +02:00
parent 4a0c0d85d2
commit 780b5ab62a

View File

@ -48,8 +48,8 @@ struct testClearQosStruct {
#define PARSE(xml, var) \ #define PARSE(xml, var) \
do { \ do { \
int rc; \ int rc; \
xmlDocPtr doc; \ g_autoptr(xmlDoc) doc = NULL; \
xmlXPathContextPtr ctxt = NULL; \ g_autoptr(xmlXPathContext) ctxt = NULL; \
\ \
if (!xml) \ if (!xml) \
break; \ break; \
@ -63,8 +63,6 @@ struct testClearQosStruct {
NULL, \ NULL, \
ctxt->node, \ ctxt->node, \
true); \ true); \
xmlFreeDoc(doc); \
xmlXPathFreeContext(ctxt); \
if (rc < 0) \ if (rc < 0) \
goto cleanup; \ goto cleanup; \
} while (0) } while (0)
@ -160,7 +158,7 @@ testVirNetDevOpenvswitchInterfaceSetQos(const void *data)
const char *iface = info->iface; const char *iface = info->iface;
g_autoptr(virNetDevBandwidth) band = NULL; g_autoptr(virNetDevBandwidth) band = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *actual_cmd = NULL; g_autofree char *actual_cmd = NULL;
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
PARSE(info->band, band); PARSE(info->band, band);
@ -187,7 +185,6 @@ testVirNetDevOpenvswitchInterfaceSetQos(const void *data)
ret = 0; ret = 0;
cleanup: cleanup:
VIR_FREE(actual_cmd);
return ret; return ret;
} }
@ -198,7 +195,7 @@ testVirNetDevOpenvswitchInterfaceClearQos(const void *data)
int ret = -1; int ret = -1;
const struct testClearQosStruct *info = data; const struct testClearQosStruct *info = data;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
char *actual_cmd = NULL; g_autofree char *actual_cmd = NULL;
const char *iface = info->iface; const char *iface = info->iface;
const unsigned char *vmid = info->vmid; const unsigned char *vmid = info->vmid;
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
@ -222,7 +219,6 @@ testVirNetDevOpenvswitchInterfaceClearQos(const void *data)
ret = 0; ret = 0;
cleanup: cleanup:
VIR_FREE(actual_cmd);
return ret; return ret;
} }