Re: [PATCH 05/22] pci: make virPCIDeviceDetach consistent in behavior

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

 



On Mon, Jun 24, 2013 at 05:54:54AM -0400, Laine Stump wrote:
> virPCIDeviceDetach would previously sometimes consume the input device
> object (to put it on the inactive list) and sometimes not. Avoiding
> memory leaks required checking beforehand to see if the device was
> already on the list, and freeing the device object in the caller only
> if there wasn't already an identical object on the inactive list.
> 
> This patch makes it consistent - virPCIDeviceDetach will *never*
> consume the input virPCIDevice object; if it needs to put one on the
> inactive list, it will create a copy and put *that* on the list. This
> way the caller knows that it is always their responsibility to free
> the device object they created.
> ---
>  src/qemu/qemu_driver.c |  8 +++-----
>  src/util/virpci.c      | 26 ++++++++++++++++++++++++--
>  2 files changed, 27 insertions(+), 7 deletions(-)

ACK much safer semantics.


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]