qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [Qemu-devel] [PATCH-trivial] arch_init.c: Free 'cache


From: Markus Armbruster
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH-trivial] arch_init.c: Free 'cache' in cache_fini() to avoid memory leak
Date: Wed, 04 Jun 2014 12:54:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Chen Gang <address@hidden> writes:

> On 06/04/2014 04:16 PM, Markus Armbruster wrote:
>> Chen Gang <address@hidden> writes:
>> 
>>> Call g_free() after cache_fini() in migration_end(), but do not call
>>> g_free() after call cache_fini() in xbzrle_cache_resize() which will
>>> cause memory leak.
>>>
>>> cache_init() and cache_fini() are pair, so need let cache_fini() call
>>> g_free(cache) to match cache_init(), then fix current issue too.
>> 
>> I'm not sure I get you.  Is the following accurate?
>> 
>>     migration: Plug memory leak in migrate-set-cache-size command
>> 
>>     We call g_free() after cache_fini() in migration_end(), but we don't
>>     call it after cache_fini() in xbzrle_cache_resize(), leaking the
>>     memory.
>> 
>>     cache_init() and cache_fini() are a pair.  Since cache_init()
>>     allocates the cache, let cache_fini() free it.  This plugs the leak.
>> 
>
> Yeah, and excuse me for my poor English.

No problem, we figured it out together :)

Would be nice to use the above text as commit message.  Perhaps it can
be done on commit.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]