Re: [PATCH 04/22] pci: eliminate memory leak in virPCIDeviceReattach

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

 



On 06/24/2013 10:57 AM, Daniel P. Berrange wrote:
> On Mon, Jun 24, 2013 at 05:54:53AM -0400, Laine Stump wrote:
>> virPCIDeviceReattach was making the assumption that the dev object
>> given to it was one and the same with the dev object on the
>> inactiveDevs list. If that had been the case, it would not need to
>> free the dev object it removed from the inactive list, because the
>> caller of virPCIDeviceReattach always frees the dev object that it
>> passes in. Since the dev object passed in is *never* the same object
>> that's on the list (it is a different object with the same name and
>> attributes, created just for the purpose of searching for the actual
>> object), simply doing a "ListSteal" to remove the object from the list
>> results in one leaked object; we need to actually free the object
>> after removing it from the list.
>> ---
>>  src/util/virpci.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/util/virpci.c b/src/util/virpci.c
>> index 10e95bd..1108ef2 100644
>> --- a/src/util/virpci.c
>> +++ b/src/util/virpci.c
>> @@ -1266,7 +1266,7 @@ virPCIDeviceReattach(virPCIDevicePtr dev,
>>  
>>      /* Steal the dev from list inactiveDevs */
>>      if (inactiveDevs)
>> -        virPCIDeviceListSteal(inactiveDevs, dev);
>> +        virPCIDeviceListDel(inactiveDevs, dev);
>>  
>>      return 0;
>>  }
> ACK


Pushed. Thanks!

--
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]