tests: replace explicit virNetworkDefFree() with g_autoptr(virNetworkDef)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Laine Stump 2022-08-18 13:26:34 -04:00
parent 8e71e5b10e
commit d9074b8e01
3 changed files with 3 additions and 6 deletions

View File

@ -89,7 +89,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
{
g_autofree char *actualargv = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virNetworkDef *def = NULL;
g_autoptr(virNetworkDef) def = NULL;
int ret = -1;
char *actual;
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
@ -117,7 +117,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
ret = 0;
cleanup:
virNetworkDefFree(def);
return ret;
}

View File

@ -27,7 +27,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
g_autofree char *actual = NULL;
int ret;
testCompareNetXML2XMLResult result = TEST_COMPARE_NET_XML2XML_RESULT_SUCCESS;
virNetworkDef *dev = NULL;
g_autoptr(virNetworkDef) dev = NULL;
g_autoptr(virNetworkXMLOption) xmlopt = NULL;
if (!(xmlopt = networkDnsmasqCreateXMLConf()))
@ -68,7 +68,6 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
}
virResetLastError();
virNetworkDefFree(dev);
return ret;
}

View File

@ -20,7 +20,7 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
g_autofree char *updateXmlData = NULL;
g_autofree char *actual = NULL;
int ret = -1;
virNetworkDef *def = NULL;
g_autoptr(virNetworkDef) def = NULL;
if (virTestLoadFile(updatexml, &updateXmlData) < 0)
goto error;
@ -53,7 +53,6 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
}
}
error:
virNetworkDefFree(def);
return ret;
}