From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiEJ3-00070c-N4 for qemu-devel@nongnu.org; Fri, 22 Jun 2012 20:34:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SiEJ1-0007wz-OW for qemu-devel@nongnu.org; Fri, 22 Jun 2012 20:34:29 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:36193) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiEJ1-0007st-G6 for qemu-devel@nongnu.org; Fri, 22 Jun 2012 20:34:27 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so4321638pbb.4 for ; Fri, 22 Jun 2012 17:34:26 -0700 (PDT) Sender: fluxion From: Michael Roth Date: Fri, 22 Jun 2012 19:33:19 -0500 Message-Id: <1340411610-22596-16-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1340411610-22596-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1340411610-22596-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH stable-1.1 15/26] monitor: Fix memory leak with readline completion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com From: Stefan Weil 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 Reviewed-by: Stefan Hajnoczi --- readline.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/readline.c b/readline.c index a6c0039..540cd8a 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.4.1