mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-10 05:31:29 +00:00
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 3fe9d75ab641f5b676845980a0ee7aef8148da9b)
This commit is contained in:
parent
0cddbe00b5
commit
14bc1e94d5
@ -1129,7 +1129,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)) {
|
||||
@ -1139,7 +1139,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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user