In virDomainMemoryDefParseXML and virDomainVideoDefParseXML if
the VIR_ALLOC fails and NULL is returned, then the alteration
to ctxt->node isn't reversed.
Found by Coverity
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/domain_conf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1ee43950ae..9911d56130 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15089,11 +15089,11 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xmlopt,
char *vgamem = NULL;
char *primary = NULL;
- ctxt->node = node;
-
if (!(def = virDomainVideoDefNew()))
return NULL;
+ ctxt->node = node;
+
cur = node->children;
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) {
@@ -15830,11 +15830,11 @@ virDomainMemoryDefParseXML(virDomainXMLOptionPtr xmlopt,
virDomainMemoryDefPtr def;
int val;
- ctxt->node = memdevNode;
-
if (VIR_ALLOC(def) < 0)
return NULL;
+ ctxt->node = memdevNode;
+
if (!(tmp = virXMLPropString(memdevNode, "model"))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing memory model"));
--
2.17.1