[libvirt PATCH v2 2/8] cpu_map: Use g_auto* in loadData

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/cpu/cpu_map.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c
index 65d244e011..53c8cbba6b 100644
--- a/src/cpu/cpu_map.c
+++ b/src/cpu/cpu_map.c
@@ -55,8 +55,9 @@ loadData(const char *mapfile,
     }
 
     for (i = 0; i < n; i++) {
-        char *name = virXMLPropString(nodes[i], "name");
-        if (!name) {
+        g_autofree char *name = NULL;
+
+        if (!(name = virXMLPropString(nodes[i], "name"))) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("cannot find %s name in CPU map '%s'"), element, mapfile);
             return -1;
@@ -64,7 +65,6 @@ loadData(const char *mapfile,
         VIR_DEBUG("Load %s name %s", element, name);
         ctxt->node = nodes[i];
         rv = callback(ctxt, name, data);
-        VIR_FREE(name);
         if (rv < 0)
             return -1;
     }
-- 
2.26.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