From 1e67130b635fb6ead17a27d3c60bb25e60315df1 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 22 Nov 2021 16:40:33 +0100 Subject: [PATCH] virSecurityLabelDefParseXML: Use automatic freeing for 'seclabel' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/conf/domain_conf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index df0d033d0b..99bee98df8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7802,7 +7802,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt, { g_autofree char *model = NULL; g_autofree char *relabel = NULL; - virSecurityLabelDef *seclabel = NULL; + g_autoptr(virSecurityLabelDef) seclabel = NULL; model = virXMLPropStringLimit(ctxt->node, "model", VIR_SECURITY_MODEL_BUFLEN - 1); @@ -7862,7 +7862,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt, /* combination of relabel='yes' and type='static' * is checked a few lines above. */ } - return seclabel; + return g_steal_pointer(&seclabel); } /* Only parse label, if using static labels, or @@ -7899,10 +7899,9 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt, VIR_SECURITY_LABEL_BUFLEN-1, ctxt); } - return seclabel; + return g_steal_pointer(&seclabel); error: - virSecurityLabelDefFree(seclabel); return NULL; }