From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sfa23-000052-Bk for qemu-devel@nongnu.org; Fri, 15 Jun 2012 13:10:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sfa21-0002Tn-FP for qemu-devel@nongnu.org; Fri, 15 Jun 2012 13:09:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15515) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sfa21-0002TP-73 for qemu-devel@nongnu.org; Fri, 15 Jun 2012 13:09:57 -0400 From: Luiz Capitulino Date: Fri, 15 Jun 2012 14:10:01 -0300 Message-Id: <1339780205-3447-5-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1339780205-3447-1-git-send-email-lcapitulino@redhat.com> References: <1339780205-3447-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 4/8] monitor: Fix memory leak with readline completion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@us.ibm.com Cc: Stefan Weil , qemu-devel@nongnu.org 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 Signed-off-by: Luiz Capitulino --- readline.c | 3 +++ 1 file changed, 3 insertions(+) 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.10.2.565.gbd578b5