From: Stefan Weil Date: Mon, 14 May 2012 09:47:20 +0000 (+0000) Subject: monitor: Fix memory leak with readline completion X-Git-Tag: v1.1.1~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c49dd1bf6450b7880972b2f176ec10e8a496073c;p=thirdparty%2Fqemu.git monitor: Fix memory leak with readline completion 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 (cherry picked from commit fc9fa4bd0a295ac18808c4cd2cfac484bc4649d3) Signed-off-by: Michael Roth --- diff --git a/readline.c b/readline.c index a6c0039ad2c..540cd8a025d 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 */