]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
monitor: Fix memory leak with readline completion
authorStefan Weil <sw@weilnetz.de>
Mon, 14 May 2012 09:47:20 +0000 (09:47 +0000)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 25 Jun 2012 13:53:25 +0000 (08:53 -0500)
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 <sw@weilnetz.de>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit fc9fa4bd0a295ac18808c4cd2cfac484bc4649d3)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
readline.c

index a6c0039ad2c23bae5817f7ac37f1b1b73487800f..540cd8a025d145dd3fe28e538bd79f9198e9c5fc 100644 (file)
@@ -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 */