From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1WthHt-0000lj-LJ for mharc-qemu-trivial@gnu.org; Sun, 08 Jun 2014 13:53:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WthHl-0000b6-2J for qemu-trivial@nongnu.org; Sun, 08 Jun 2014 13:53:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WthHe-0005Ws-Ja for qemu-trivial@nongnu.org; Sun, 08 Jun 2014 13:53:37 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:42884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WthHS-0005Qi-2j; Sun, 08 Jun 2014 13:53:18 -0400 Received: from [192.168.88.2] (mjt.vpn.tls.msk.ru [192.168.177.99]) by isrv.corpit.ru (Postfix) with ESMTP id D110640E06; Sun, 8 Jun 2014 21:53:13 +0400 (MSK) Message-ID: <5394A309.2010808@msgid.tls.msk.ru> Date: Sun, 08 Jun 2014 21:53:13 +0400 From: Michael Tokarev Organization: Telecom Service, JSC User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: Chen Gang , quintela@redhat.com, arei.gonglei@huawei.com, Eric Blake , dgilbert@redhat.com, owasserm@redhat.com References: <538C6B37.2030400@gmail.com> In-Reply-To: <538C6B37.2030400@gmail.com> X-Enigmail-Version: 1.6 OpenPGP: id=804465C5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 86.62.121.231 Cc: QEMU Trivial , QEMU Developers Subject: Re: [Qemu-trivial] [PATCH-trivial] arch_init.c: Free 'cache' in cache_fini() to avoid memory leak X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jun 2014 17:53:43 -0000 02.06.2014 16:16, Chen Gang wrote: > 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. Applied to -trivial, with the following commit message: 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. Thanks, /mjt From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WthHY-0000UT-Ee for qemu-devel@nongnu.org; Sun, 08 Jun 2014 13:53:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WthHS-0005Qp-9j for qemu-devel@nongnu.org; Sun, 08 Jun 2014 13:53:24 -0400 Message-ID: <5394A309.2010808@msgid.tls.msk.ru> Date: Sun, 08 Jun 2014 21:53:13 +0400 From: Michael Tokarev MIME-Version: 1.0 References: <538C6B37.2030400@gmail.com> In-Reply-To: <538C6B37.2030400@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH-trivial] arch_init.c: Free 'cache' in cache_fini() to avoid memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chen Gang , quintela@redhat.com, arei.gonglei@huawei.com, Eric Blake , dgilbert@redhat.com, owasserm@redhat.com Cc: QEMU Trivial , QEMU Developers 02.06.2014 16:16, Chen Gang wrote: > 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. Applied to -trivial, with the following commit message: 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. Thanks, /mjt