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@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
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) {
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"));