Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/cpu/cpu_map.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c index c315ab32b2..1b73249649 100644 --- a/src/cpu/cpu_map.c +++ b/src/cpu/cpu_map.c @@ -81,10 +81,9 @@ cpuMapLoadInclude(const char *filename, cpuMapLoadCallback modelCB, void *data) { - xmlDocPtr xml = NULL; - xmlXPathContextPtr ctxt = NULL; - int ret = -1; - char *mapfile; + g_autoptr(xmlDoc) xml = NULL; + g_autoptr(xmlXPathContext) ctxt = NULL; + g_autofree char *mapfile = NULL; if (!(mapfile = virFileFindResource(filename, abs_top_srcdir "/src/cpu_map", @@ -94,27 +93,20 @@ cpuMapLoadInclude(const char *filename, VIR_DEBUG("Loading CPU map include from %s", mapfile); if (!(xml = virXMLParseFileCtxt(mapfile, &ctxt))) - goto cleanup; + return -1; ctxt->node = xmlDocGetRootElement(xml); if (loadData(mapfile, ctxt, "vendor", vendorCB, data) < 0) - goto cleanup; + return -1; if (loadData(mapfile, ctxt, "feature", featureCB, data) < 0) - goto cleanup; + return -1; if (loadData(mapfile, ctxt, "model", modelCB, data) < 0) - goto cleanup; - - ret = 0; - - cleanup: - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xml); - VIR_FREE(mapfile); + return -1; - return ret; + return 0; } -- 2.26.2