1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +03:00

virSecretDefParseUsage: Use g_autofree for type_str

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-01-06 15:51:26 +01:00
parent 3e0d9131cc
commit a177c56ddd

View File

@ -52,7 +52,7 @@ static int
virSecretDefParseUsage(xmlXPathContextPtr ctxt,
virSecretDefPtr def)
{
char *type_str;
g_autofree char *type_str = NULL;
int type;
type_str = virXPathString("string(./usage/@type)", ctxt);
@ -65,10 +65,8 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt,
if (type < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown secret usage type %s"), type_str);
VIR_FREE(type_str);
return -1;
}
VIR_FREE(type_str);
def->usage_type = type;
switch (def->usage_type) {
case VIR_SECRET_USAGE_TYPE_NONE: