Signed-off-by: Tim Wiederhake <twied...@redhat.com> --- src/cpu/cpu_map.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c index 53c8cbba6b..743547c6d1 100644 --- a/src/cpu/cpu_map.c +++ b/src/cpu/cpu_map.c @@ -125,18 +125,16 @@ loadIncludes(xmlXPathContextPtr ctxt, return -1; for (i = 0; i < n; i++) { - char *filename = virXMLPropString(nodes[i], "filename"); + g_autofree char *filename = virXMLPropString(nodes[i], "filename"); + if (!filename) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing 'filename' in CPU map include")); return -1; } VIR_DEBUG("Finding CPU map include '%s'", filename); - if (cpuMapLoadInclude(filename, vendorCB, featureCB, modelCB, data) < 0) { - VIR_FREE(filename); + if (cpuMapLoadInclude(filename, vendorCB, featureCB, modelCB, data) < 0) return -1; - } - VIR_FREE(filename); } return 0; -- 2.26.2