From 526acb6a7f068c833870eabced8f2201f84f7ddc Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Fri, 21 Oct 2016 18:33:41 -0400 Subject: [PATCH] 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: John Ferlan --- 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 bf55f014a6..de7df5c78a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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; -- GitLab