conf: domain: Automatically free 'def' and 'actual' in virDomainNetDefParseXML

Convert the last two variables having inline cleanup to automatic
cleanup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-09-15 15:52:21 +02:00
parent d409d25cea
commit 4721354f44

View File

@ -8833,7 +8833,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned int flags) unsigned int flags)
{ {
virDomainNetDef *def; g_autoptr(virDomainNetDef) def = NULL;
virDomainHostdevDef *hostdev; virDomainHostdevDef *hostdev;
xmlNodePtr source_node = NULL; xmlNodePtr source_node = NULL;
xmlNodePtr virtualport_node = NULL; xmlNodePtr virtualport_node = NULL;
@ -8845,7 +8845,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
xmlNodePtr tmpNode; xmlNodePtr tmpNode;
xmlNodePtr mac_node = NULL; xmlNodePtr mac_node = NULL;
g_autoptr(GHashTable) filterparams = NULL; g_autoptr(GHashTable) filterparams = NULL;
virDomainActualNetDef *actual = NULL; g_autoptr(virDomainActualNetDef) actual = NULL;
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
virDomainChrSourceReconnectDef reconnect = {0}; virDomainChrSourceReconnectDef reconnect = {0};
int rv, val; int rv, val;
@ -9571,13 +9571,10 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
if (virNetworkPortOptionsParseXML(ctxt, &def->isolatedPort) < 0) if (virNetworkPortOptionsParseXML(ctxt, &def->isolatedPort) < 0)
goto error; goto error;
cleanup: return g_steal_pointer(&def);
virDomainActualNetDefFree(actual);
return def;
error: error:
g_clear_pointer(&def, virDomainNetDefFree); return NULL;
goto cleanup;
} }
static int static int