提交 db2c3c80 编写于 作者: P Peter Krempa

conf: domain: Refactor cleanup in virDomainDefParseNode

Use VIR_AUTOPTR for temporary locals and get rid of the cleanup label.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
上级 f02b4fc4
......@@ -21558,32 +21558,26 @@ virDomainDefParseNode(xmlDocPtr xml,
void *parseOpaque,
unsigned int flags)
{
xmlXPathContextPtr ctxt = NULL;
virDomainDefPtr def = NULL;
virDomainDefPtr ret = NULL;
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
VIR_AUTOPTR(virDomainDef) def = NULL;
if (!(ctxt = virXMLXPathContextNew(xml)))
goto cleanup;
return NULL;
ctxt->node = root;
if (!(def = virDomainDefParseXML(xml, ctxt, caps, xmlopt, flags)))
goto cleanup;
return NULL;
/* callback to fill driver specific domain aspects */
if (virDomainDefPostParse(def, caps, flags, xmlopt, parseOpaque) < 0)
goto cleanup;
return NULL;
/* validate configuration */
if (virDomainDefValidate(def, caps, flags, xmlopt) < 0)
goto cleanup;
VIR_STEAL_PTR(ret, def);
return NULL;
cleanup:
virDomainDefFree(def);
xmlXPathFreeContext(ctxt);
return ret;
VIR_RETURN_PTR(def);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册