mirror of https://gitee.com/openkylin/libvirt.git
conf: cleanup error path in virDomainStorageSourceParse
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7981eadf92
commit
afbf71af24
|
@ -9081,7 +9081,6 @@ virDomainStorageSourceParse(xmlNodePtr node,
|
||||||
virStorageSourcePtr src,
|
virStorageSourcePtr src,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||||
xmlNodePtr tmp;
|
xmlNodePtr tmp;
|
||||||
|
|
||||||
|
@ -9099,34 +9098,34 @@ virDomainStorageSourceParse(xmlNodePtr node,
|
||||||
break;
|
break;
|
||||||
case VIR_STORAGE_TYPE_NETWORK:
|
case VIR_STORAGE_TYPE_NETWORK:
|
||||||
if (virDomainDiskSourceNetworkParse(node, ctxt, src, flags) < 0)
|
if (virDomainDiskSourceNetworkParse(node, ctxt, src, flags) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
break;
|
break;
|
||||||
case VIR_STORAGE_TYPE_VOLUME:
|
case VIR_STORAGE_TYPE_VOLUME:
|
||||||
if (virDomainDiskSourcePoolDefParse(node, &src->srcpool) < 0)
|
if (virDomainDiskSourcePoolDefParse(node, &src->srcpool) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
break;
|
break;
|
||||||
case VIR_STORAGE_TYPE_NONE:
|
case VIR_STORAGE_TYPE_NONE:
|
||||||
case VIR_STORAGE_TYPE_LAST:
|
case VIR_STORAGE_TYPE_LAST:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected disk type %s"),
|
_("unexpected disk type %s"),
|
||||||
virStorageTypeToString(src->type));
|
virStorageTypeToString(src->type));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tmp = virXPathNode("./auth", ctxt)) &&
|
if ((tmp = virXPathNode("./auth", ctxt)) &&
|
||||||
!(src->auth = virStorageAuthDefParse(tmp, ctxt)))
|
!(src->auth = virStorageAuthDefParse(tmp, ctxt)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if ((tmp = virXPathNode("./encryption", ctxt)) &&
|
if ((tmp = virXPathNode("./encryption", ctxt)) &&
|
||||||
!(src->encryption = virStorageEncryptionParseNode(tmp, ctxt)))
|
!(src->encryption = virStorageEncryptionParseNode(tmp, ctxt)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virDomainDiskSourcePRParse(node, ctxt, &src->pr) < 0)
|
if (virDomainDiskSourcePRParse(node, ctxt, &src->pr) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virSecurityDeviceLabelDefParseXML(&src->seclabels, &src->nseclabels,
|
if (virSecurityDeviceLabelDefParseXML(&src->seclabels, &src->nseclabels,
|
||||||
ctxt, flags) < 0)
|
ctxt, flags) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/* People sometimes pass a bogus '' source path when they mean to omit the
|
/* People sometimes pass a bogus '' source path when they mean to omit the
|
||||||
* source element completely (e.g. CDROM without media). This is just a
|
* source element completely (e.g. CDROM without media). This is just a
|
||||||
|
@ -9134,10 +9133,7 @@ virDomainStorageSourceParse(xmlNodePtr node,
|
||||||
if (src->path && !*src->path)
|
if (src->path && !*src->path)
|
||||||
VIR_FREE(src->path);
|
VIR_FREE(src->path);
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue