From: Peter Krempa Date: Wed, 6 Jan 2021 14:51:26 +0000 (+0100) Subject: virSecretDefParseUsage: Use g_autofree for type_str X-Git-Tag: v7.0.0-rc1~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a177c56ddd85259a01d3359d2a5559a4d04c2dc7;p=thirdparty%2Flibvirt.git virSecretDefParseUsage: Use g_autofree for type_str Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c index 273987bdb4..9cacc43e28 100644 --- a/src/conf/secret_conf.c +++ b/src/conf/secret_conf.c @@ -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: