From: Boris Fiuczynski Date: Fri, 23 Oct 2020 17:31:51 +0000 (+0200) Subject: conf: node_device: cleanup virNodeDevCapCCWParseXML X-Git-Tag: v6.10.0-rc1~332 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=469429923429b6e08404d903fe2abf790ce3c965;p=thirdparty%2Flibvirt.git conf: node_device: cleanup virNodeDevCapCCWParseXML Make use of g_autofree Signed-off-by: Boris Fiuczynski Reviewed-by: Bjoern Walk Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index fea70100a7..a57505a27e 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -850,57 +850,52 @@ virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt, virNodeDevCapCCWPtr ccw_dev) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - int ret = -1; - char *cssid = NULL, *ssid = NULL, *devno = NULL; + g_autofree char *cssid = NULL; + g_autofree char *ssid = NULL; + g_autofree char *devno = NULL; ctxt->node = node; - if (!(cssid = virXPathString("string(./cssid[1])", ctxt))) { + if (!(cssid = virXPathString("string(./cssid[1])", ctxt))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("missing cssid value for '%s'"), def->name); - goto out; + return -1; } if (virStrToLong_uip(cssid, NULL, 0, &ccw_dev->cssid) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("invalid cssid value '%s' for '%s'"), cssid, def->name); - goto out; + return -1; } if (!(ssid = virXPathString("string(./ssid[1])", ctxt))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("missing ssid value for '%s'"), def->name); - goto out; + return -1; } if (virStrToLong_uip(ssid, NULL, 0, &ccw_dev->ssid) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("invalid ssid value '%s' for '%s'"), cssid, def->name); - goto out; + return -1; } if (!(devno = virXPathString("string(./devno[1])", ctxt))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("missing devno value for '%s'"), def->name); - goto out; + return -1; } if (virStrToLong_uip(devno, NULL, 16, &ccw_dev->devno) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("invalid devno value '%s' for '%s'"), devno, def->name); - goto out; + return -1; } - ret = 0; - - out: - VIR_FREE(cssid); - VIR_FREE(ssid); - VIR_FREE(devno); - return ret; + return 0; }