[PATCH 1/7] virSecretDefParseUsage: Use g_autofree for type_str

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/secret_conf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

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:
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux