mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-22 14:09:22 +00:00
virSecurityLabelDefParseXML: Use automatic freeing for 'seclabel'
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
0cb3e162a6
commit
1e67130b63
@ -7802,7 +7802,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
{
|
{
|
||||||
g_autofree char *model = NULL;
|
g_autofree char *model = NULL;
|
||||||
g_autofree char *relabel = NULL;
|
g_autofree char *relabel = NULL;
|
||||||
virSecurityLabelDef *seclabel = NULL;
|
g_autoptr(virSecurityLabelDef) seclabel = NULL;
|
||||||
|
|
||||||
model = virXMLPropStringLimit(ctxt->node, "model",
|
model = virXMLPropStringLimit(ctxt->node, "model",
|
||||||
VIR_SECURITY_MODEL_BUFLEN - 1);
|
VIR_SECURITY_MODEL_BUFLEN - 1);
|
||||||
@ -7862,7 +7862,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
/* combination of relabel='yes' and type='static'
|
/* combination of relabel='yes' and type='static'
|
||||||
* is checked a few lines above. */
|
* is checked a few lines above. */
|
||||||
}
|
}
|
||||||
return seclabel;
|
return g_steal_pointer(&seclabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only parse label, if using static labels, or
|
/* Only parse label, if using static labels, or
|
||||||
@ -7899,10 +7899,9 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
|
VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
return seclabel;
|
return g_steal_pointer(&seclabel);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virSecurityLabelDefFree(seclabel);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user