[libvirt] [PATCH] virsh: Plug memory leak on cmdDesc

Alex Jia ajia at redhat.com
Wed Feb 8 07:18:28 UTC 2012


On 02/08/2012 03:07 PM, Osier Yang wrote:
Thanks and pushed now.

Alex
> On 2012年02月08日 14:00, ajia at redhat.com wrote:
>> From: Alex Jia<ajia at redhat.com>
>>
>> Forgot to free the domain object, this will intruduce resource leaks 
>> including
>> memory leak and FD leaks.
>>
>> * tools/virsh.c(cmdDesc): fix memory leak.
>>
>> * How to reproduce?
>> % virsh desc<domain>
>> No description for domain:<domain>
>> error: Failed to disconnect from the hypervisor, 1 leaked reference(s)
>>
>> Signed-off-by: Alex Jia<ajia at redhat.com>
>> ---
>>   tools/virsh.c |    2 ++
>>   1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/tools/virsh.c b/tools/virsh.c
>> index bff7d5d..c107d8c 100644
>> --- a/tools/virsh.c
>> +++ b/tools/virsh.c
>> @@ -1167,6 +1167,8 @@ cleanup:
>>           unlink(tmp);
>>           VIR_FREE(tmp);
>>       }
>> +    if (dom)
>> +        virDomainFree(dom);
>>       return ret;
>>   }
>>
>
> ACK
>
> -- 
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list