Received: from eggs.gnu.org ([208.118.235.92]:34727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SU1Er-000401-Ez for qemu-devel@nongnu.org; Mon, 14 May 2012 15:47:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SU1Ep-00072J-On for qemu-devel@nongnu.org; Mon, 14 May 2012 15:47:25 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:52002) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SU1Ep-000725-In for qemu-devel@nongnu.org; Mon, 14 May 2012 15:47:23 -0400 From: Stefan Weil Date: Mon, 14 May 2012 21:47:20 +0200 Message-Id: <1337024840-28273-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH 1.1] monitor: Fix memory leak with readline completion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Stefan Weil , qemu-devel@nongnu.org Each string which is shown during readline completion in the QEMU monitor is allocated dynamically but currently never deallocated. Add the missing loop which calls g_free for the allocated strings. Signed-off-by: Stefan Weil --- readline.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readline.c b/readline.c index a6c0039..646b6e8 100644 --- a/readline.c +++ b/readline.c @@ -337,6 +337,9 @@ static void readline_completion(ReadLineState *rs) } readline_show_prompt(rs); } + for (i = 0; i < rs->nb_completions; i++) { + g_free(rs->completions[i]); + } } /* return true if command handled */ -- 1.7.10