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

Properly check the return value of CCWAddressAsString

It returns NULL on failure. Checking if the negation of it
is less than zero makes no sense. (Found by coverity after moving
the code)

In another case, the return value wasn't checked at all.

(cherry picked from commit 3fe9d75a)

Conflicts:
	src/conf/domain_addr.c - no code movement from commit b2626755
上级 57b6cfaf
......@@ -1112,7 +1112,7 @@ int qemuDomainCCWAddressAssign(virDomainDeviceInfoPtr dev,
goto cleanup;
}
} else if (autoassign && !dev->addr.ccw.assigned) {
if (!(addr = qemuCCWAddressAsString(&addrs->next)) < 0)
if (!(addr = qemuCCWAddressAsString(&addrs->next)))
goto cleanup;
while (virHashLookup(addrs->defined, addr)) {
......@@ -1122,7 +1122,8 @@ int qemuDomainCCWAddressAssign(virDomainDeviceInfoPtr dev,
goto cleanup;
}
VIR_FREE(addr);
addr = qemuCCWAddressAsString(&addrs->next);
if (!(addr = qemuCCWAddressAsString(&addrs->next)))
goto cleanup;
}
dev->addr.ccw = addrs->next;
dev->addr.ccw.assigned = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册