mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +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 commit3fe9d75ab6
) Conflicts: src/conf/domain_addr.c - no code movement from commitb2626755
This commit is contained in:
parent
36460fb15e
commit
0e8910a0a1
@ -1131,7 +1131,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)) {
|
||||
@ -1141,7 +1141,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…
Reference in New Issue
Block a user