qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1.1] monitor: Fix memory leak with readline completi


From: Stefan Weil
Subject: [Qemu-devel] [PATCH 1.1] monitor: Fix memory leak with readline completion
Date: Mon, 14 May 2012 21:47:20 +0200

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 <address@hidden>
---
 readline.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/readline.c b/readline.c
index a6c0039..646b6e8 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]