mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 13:57:43 +03:00
conf: Alter when ctxt->node is set
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>
This commit is contained in:
parent
4374900040
commit
f5c7d8890b
@ -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"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user