Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
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