提交 526acb6a 编写于 作者: J John Ferlan

conf: Use virDomainChrSourceDefNew for virDomainRNGDef allocation

Rather than VIR_ALLOC() the data, use virDomainChrSourceDefNew in order
to get the private data if necessary.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 99382262
......@@ -12099,7 +12099,8 @@ virDomainWatchdogDefParseXML(xmlNodePtr node,
static virDomainRNGDefPtr
virDomainRNGDefParseXML(xmlNodePtr node,
virDomainRNGDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
xmlXPathContextPtr ctxt,
unsigned int flags)
{
......@@ -12172,7 +12173,7 @@ virDomainRNGDefParseXML(xmlNodePtr node,
goto error;
}
if (VIR_ALLOC(def->source.chardev) < 0)
if (!(def->source.chardev = virDomainChrSourceDefNew(xmlopt)))
goto error;
def->source.chardev->type = virDomainChrTypeFromString(type);
......@@ -13592,7 +13593,8 @@ virDomainDeviceDefParse(const char *xmlStr,
goto error;
break;
case VIR_DOMAIN_DEVICE_RNG:
if (!(dev->data.rng = virDomainRNGDefParseXML(node, ctxt, flags)))
if (!(dev->data.rng = virDomainRNGDefParseXML(xmlopt, node,
ctxt, flags)))
goto error;
break;
case VIR_DOMAIN_DEVICE_CHR:
......@@ -17481,9 +17483,8 @@ virDomainDefParseXML(xmlDocPtr xml,
if (n && VIR_ALLOC_N(def->rngs, n) < 0)
goto error;
for (i = 0; i < n; i++) {
virDomainRNGDefPtr rng = virDomainRNGDefParseXML(nodes[i],
ctxt,
flags);
virDomainRNGDefPtr rng = virDomainRNGDefParseXML(xmlopt, nodes[i],
ctxt, flags);
if (!rng)
goto error;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册