mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Don't clobber return value in virInterfaceDefParseProtoIPv6
Several places in virInterfaceDefParseProtoIPv6 clobber the default 'ret' return value. So when jumping to cleanup on error, 'ret' may mistakenly be set to 0 instead of -1. This caused failure to report OOM errors, meaning data was silently lost during parsing. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
3169991555
commit
8feae8e136
@ -309,9 +309,8 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
|
|||||||
|
|
||||||
dhcp = virXPathNode("./dhcp", ctxt);
|
dhcp = virXPathNode("./dhcp", ctxt);
|
||||||
if (dhcp != NULL) {
|
if (dhcp != NULL) {
|
||||||
ret = virInterfaceDefParseDhcp(def, dhcp, ctxt);
|
if (virInterfaceDefParseDhcp(def, dhcp, ctxt) < 0)
|
||||||
if (ret != 0)
|
return -1;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nIpNodes = virXPathNodeSet("./ip", ctxt, &ipNodes);
|
nIpNodes = virXPathNodeSet("./ip", ctxt, &ipNodes);
|
||||||
@ -332,8 +331,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
ctxt->node = ipNodes[i];
|
ctxt->node = ipNodes[i];
|
||||||
ret = virInterfaceDefParseIp(ip, ctxt);
|
if (virInterfaceDefParseIp(ip, ctxt) < 0) {
|
||||||
if (ret != 0) {
|
|
||||||
virInterfaceIpDefFree(ip);
|
virInterfaceIpDefFree(ip);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -365,9 +363,8 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
|
|||||||
|
|
||||||
dhcp = virXPathNode("./dhcp", ctxt);
|
dhcp = virXPathNode("./dhcp", ctxt);
|
||||||
if (dhcp != NULL) {
|
if (dhcp != NULL) {
|
||||||
ret = virInterfaceDefParseDhcp(def, dhcp, ctxt);
|
if (virInterfaceDefParseDhcp(def, dhcp, ctxt) < 0)
|
||||||
if (ret != 0)
|
return -1;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nIpNodes = virXPathNodeSet("./ip", ctxt, &ipNodes);
|
nIpNodes = virXPathNodeSet("./ip", ctxt, &ipNodes);
|
||||||
@ -388,8 +385,7 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
ctxt->node = ipNodes[i];
|
ctxt->node = ipNodes[i];
|
||||||
ret = virInterfaceDefParseIp(ip, ctxt);
|
if (virInterfaceDefParseIp(ip, ctxt) < 0) {
|
||||||
if (ret != 0) {
|
|
||||||
virInterfaceIpDefFree(ip);
|
virInterfaceIpDefFree(ip);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user