mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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 *vgamem = NULL;
|
||||||
char *primary = NULL;
|
char *primary = NULL;
|
||||||
|
|
||||||
ctxt->node = node;
|
|
||||||
|
|
||||||
if (!(def = virDomainVideoDefNew()))
|
if (!(def = virDomainVideoDefNew()))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
ctxt->node = node;
|
||||||
|
|
||||||
cur = node->children;
|
cur = node->children;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
if (cur->type == XML_ELEMENT_NODE) {
|
if (cur->type == XML_ELEMENT_NODE) {
|
||||||
@ -15830,11 +15830,11 @@ virDomainMemoryDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||||||
virDomainMemoryDefPtr def;
|
virDomainMemoryDefPtr def;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
ctxt->node = memdevNode;
|
|
||||||
|
|
||||||
if (VIR_ALLOC(def) < 0)
|
if (VIR_ALLOC(def) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
ctxt->node = memdevNode;
|
||||||
|
|
||||||
if (!(tmp = virXMLPropString(memdevNode, "model"))) {
|
if (!(tmp = virXMLPropString(memdevNode, "model"))) {
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("missing memory model"));
|
_("missing memory model"));
|
||||||
|
Loading…
Reference in New Issue
Block a user