From 4380be0e997284159e634100d2f5ec87f944d74d Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Mon, 2 Jun 2014 20:16:55 +0800 Subject: 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. Signed-off-by: Chen Gang Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Michael Tokarev --- arch_init.c | 1 - 1 file changed, 1 deletion(-) (limited to 'arch_init.c') diff --git a/arch_init.c b/arch_init.c index 9f1a174d3a..23044c1d12 100644 --- a/arch_init.c +++ b/arch_init.c @@ -739,7 +739,6 @@ static void migration_end(void) XBZRLE_cache_lock(); if (XBZRLE.cache) { cache_fini(XBZRLE.cache); - g_free(XBZRLE.cache); g_free(XBZRLE.encoded_buf); g_free(XBZRLE.current_buf); XBZRLE.cache = NULL; -- cgit v1.2.1