--- src/conf/domain_conf.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 27d505d5b..a951282db 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7598,7 +7598,7 @@ virDomainDiskSourceParse(xmlNodePtr node, virStorageSourcePtr src) { int ret = -1; - char *protocol = NULL; + char *tmp = NULL; xmlNodePtr saveNode = ctxt->node; xmlNodePtr tmpnode; @@ -7615,17 +7615,18 @@ virDomainDiskSourceParse(xmlNodePtr node, src->path = virXMLPropString(node, "dir"); break; case VIR_STORAGE_TYPE_NETWORK: - if (!(protocol = virXMLPropString(node, "protocol"))) { + if (!(tmp = virXMLPropString(node, "protocol"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing network source protocol type")); goto cleanup; } - if ((src->protocol = virStorageNetProtocolTypeFromString(protocol)) <= 0) { + if ((src->protocol = virStorageNetProtocolTypeFromString(tmp)) <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown protocol type '%s'"), protocol); + _("unknown protocol type '%s'"), tmp); goto cleanup; } + VIR_FREE(tmp); if (!(src->path = virXMLPropString(node, "name")) && src->protocol != VIR_STORAGE_NET_PROTOCOL_NBD) { @@ -7638,7 +7639,6 @@ virDomainDiskSourceParse(xmlNodePtr node, * as a part of the path. This is hard to work with when dealing with * relative names. Split out the volume into a separate variable */ if (src->path && src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER) { - char *tmp; if (!(tmp = strchr(src->path, '/')) || tmp == src->path) { virReportError(VIR_ERR_XML_ERROR, @@ -7653,6 +7653,7 @@ virDomainDiskSourceParse(xmlNodePtr node, goto cleanup; tmp[0] = '\0'; + tmp = NULL; } /* snapshot currently works only for remote disks */ @@ -7692,7 +7693,7 @@ virDomainDiskSourceParse(xmlNodePtr node, ret = 0; cleanup: - VIR_FREE(protocol); + VIR_FREE(tmp); ctxt->node = saveNode; return ret; } -- 2.12.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list