From: Tim Wiederhake Date: Fri, 11 Sep 2020 13:22:44 +0000 (+0200) Subject: cpu_map: Use g_auto* in loadIncludes X-Git-Tag: v6.8.0-rc1~205 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffa6dc0519fe597a0f38868bac2b361d844ef113;p=thirdparty%2Flibvirt.git cpu_map: Use g_auto* in loadIncludes Signed-off-by: Tim Wiederhake Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- 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;