Re: [PATCHv2 10/12] pci: eliminate leak in OOM condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 24, 2013 at 11:05:36PM -0400, Laine Stump wrote:
> 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.
> ---
>  src/util/virpci.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/src/util/virpci.c b/src/util/virpci.c
> index 378b4f3..515feea 100644
> --- a/src/util/virpci.c
> +++ b/src/util/virpci.c
> @@ -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;
>      }

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]