A helper function for allocating the virDomainGraphicsDef structure.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_conf.c | 21 +++++++++++++++++----
src/conf/domain_conf.h | 2 ++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 222bb8c482..82672c6493 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14114,10 +14114,21 @@ virDomainGraphicsDefParseXMLEGLHeadless(virDomainGraphicsDefPtr def,
return 0;
}
+virDomainGraphicsDefPtr
+virDomainGraphicsDefNew(virDomainXMLOptionPtr xmlopt ATTRIBUTE_UNUSED)
+{
+ virDomainGraphicsDefPtr def = NULL;
+
+ if (VIR_ALLOC(def) < 0)
+ return NULL;
+
+ return def;
+}
/* Parse the XML definition for a graphics device */
static virDomainGraphicsDefPtr
-virDomainGraphicsDefParseXML(xmlNodePtr node,
+virDomainGraphicsDefParseXML(virDomainXMLOptionPtr xmlopt,
+ xmlNodePtr node,
xmlXPathContextPtr ctxt,
unsigned int flags)
{
@@ -14125,7 +14136,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
char *type = NULL;
int typeVal;
- if (VIR_ALLOC(def) < 0)
+ if (!(def = virDomainGraphicsDefNew(xmlopt)))
return NULL;
type = virXMLPropString(node, "type");
@@ -16237,7 +16248,8 @@ virDomainDeviceDefParse(const char *xmlStr,
goto error;
break;
case VIR_DOMAIN_DEVICE_GRAPHICS:
- if (!(dev->data.graphics = virDomainGraphicsDefParseXML(node, ctxt, flags)))
+ if (!(dev->data.graphics = virDomainGraphicsDefParseXML(xmlopt, node,
+ ctxt, flags)))
goto error;
break;
case VIR_DOMAIN_DEVICE_HUB:
@@ -20847,7 +20859,8 @@ virDomainDefParseXML(xmlDocPtr xml,
if (n && VIR_ALLOC_N(def->graphics, n) < 0)
goto error;
for (i = 0; i < n; i++) {
- virDomainGraphicsDefPtr graphics = virDomainGraphicsDefParseXML(nodes[i],
+ virDomainGraphicsDefPtr graphics = virDomainGraphicsDefParseXML(xmlopt,
+ nodes[i],
ctxt,
flags);
if (!graphics)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index fae130668f..2a97ad8ab3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2954,6 +2954,8 @@ virDomainChrSourceDefNew(virDomainXMLOptionPtr xmlopt);
virDomainChrDefPtr virDomainChrDefNew(virDomainXMLOptionPtr xmlopt);
+virDomainGraphicsDefPtr
+virDomainGraphicsDefNew(virDomainXMLOptionPtr xmlopt);
virDomainDefPtr virDomainDefNew(void);
void virDomainObjAssignDef(virDomainObjPtr domain,
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list