提交 d5e88425 编写于 作者: J Ján Tomko 提交者: Eric Blake

conf: fix NULL check in virNetDevBandwidthParse

Found by coverity:
Error: REVERSE_INULL (CWE-476):
    libvirt-0.10.2/src/conf/netdev_bandwidth_conf.c:99: deref_ptr:
    Directly dereferencing pointer "node".
    libvirt-0.10.2/src/conf/netdev_bandwidth_conf.c:107:
    check_after_deref: Null-checking "node" suggests that it may be
    null, but it has already been dereferenced on all paths leading to
    the check.
上级 f4ea67f5
......@@ -96,7 +96,7 @@ virNetDevBandwidthPtr
virNetDevBandwidthParse(xmlNodePtr node)
{
virNetDevBandwidthPtr def = NULL;
xmlNodePtr cur = node->children;
xmlNodePtr cur;
xmlNodePtr in = NULL, out = NULL;
if (VIR_ALLOC(def) < 0) {
......@@ -110,6 +110,8 @@ virNetDevBandwidthParse(xmlNodePtr node)
goto error;
}
cur = node->children;
while (cur) {
if (cur->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(cur->name, BAD_CAST "inbound")) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册