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

Re: [libvirt] [PATCH] Fix memory leak in virDomainVcpuPinDel()



At 06/28/2011 06:38 PM, Michal Privoznik Write:
> On 28.06.2011 05:41, Wen Congyang wrote:
>> virDomainVcpuPinDefFree() does not free def->cputune.vcpupin if nvcpupin
>> is 0, and does not set def->cputune.vcpupin to NULL.
>>
>> If we set nvcpupin to 0 but do not free vcpupin, vcpupin will not be freed
>> when vm->def is freed.
>>
>> Use VIR_FREE() instead of virDomainVcpuPinDefFree() to free the memory
>> and set def->cputune.vcpupint to NULL.
>>
>> ---
>>  src/conf/domain_conf.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>> index 60e0318..f9bf51e 100644
>> --- a/src/conf/domain_conf.c
>> +++ b/src/conf/domain_conf.c
>> @@ -8263,7 +8263,7 @@ virDomainVcpuPinDel(virDomainDefPtr def, int vcpu)
>>          return 0;
>>  
>>      if (--def->cputune.nvcpupin == 0) {
>> -        virDomainVcpuPinDefFree(def->cputune.vcpupin, 0);
>> +        VIR_FREE(def->cputune.vcpupin);
>>      } else {
>>          if (VIR_REALLOC_N(def->cputune.vcpupin, def->cputune.nvcpupin) < 0) {
>>              virReportOOMError();
> 
> ACK

Thanks. Pushed.

> 
> Michal
> 


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