summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2012-05-14 09:47:20 +0000
committerMichael Roth <mdroth@linux.vnet.ibm.com>2012-06-25 08:53:25 -0500
commitc49dd1bf6450b7880972b2f176ec10e8a496073c (patch)
treefd401b1e95ae7acc3f4e2ef26944cbed8e8ad99b
parentqcow2: Silence false warning (diff)
downloadqemu-kvm-c49dd1bf6450b7880972b2f176ec10e8a496073c.tar.gz
qemu-kvm-c49dd1bf6450b7880972b2f176ec10e8a496073c.tar.bz2
qemu-kvm-c49dd1bf6450b7880972b2f176ec10e8a496073c.zip
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 <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>
-rw-r--r--readline.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/readline.c b/readline.c
index a6c0039ad..540cd8a02 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 */