mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
pci: eliminate leak in OOM condition
The "fix" I pushed a few commits ago would still leak a virPCIDevice in case of an OOM error. Although it's inconsequential in practice, this patch satisfies my OCD.
This commit is contained in:
parent
0e89a543be
commit
2a2739a866
@ -1268,11 +1268,9 @@ virPCIDeviceDetach(virPCIDevicePtr dev,
|
||||
/* Add *a copy of* the dev into list inactiveDevs, if
|
||||
* it's not already there.
|
||||
*/
|
||||
if (inactiveDevs && !virPCIDeviceListFind(inactiveDevs, dev)) {
|
||||
virPCIDevicePtr copy = virPCIDeviceCopy(dev);
|
||||
|
||||
if ((!copy) || virPCIDeviceListAdd(inactiveDevs, copy) < 0)
|
||||
return -1;
|
||||
if (inactiveDevs && !virPCIDeviceListFind(inactiveDevs, dev) &&
|
||||
virPCIDeviceListAddCopy(inactiveDevs, dev) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user