Skip to contentSkip to conversation

monitor: Fix memory leak with readline completion

PATCH Applied Stefan Weil 3 participants 5 messages May 14, 2012 – Jun 12, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 readline.c |    3 +++
 1 file changed, 3 insertions(+)
readline.c +3 -0
index a6c0039..646b6e8 100644
@@ -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 */
Signature · 1 line
1.7.10
#1 lore raw

Am 14.05.2012 21:47, schrieb Stefan Weil:

Quoted 16 lines

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.

---
  readline.c |    3 +++
  1 file changed, 3 insertions(+)
readline.c +0 -0
index a6c0039..646b6e8 100644

readline.c static void readline_completion(ReadLineState *rs) · line 345

Quoted 9 lines
readline.c +3 -0
@@ -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 */

Ping?

This patch is for QEMU 1.1, but was not committed up to now.

Regards,
Stefan Weil

#2 lore raw

Am 22.05.2012 22:24, schrieb Stefan Weil:

Quoted 24 lines

Am 14.05.2012 21:47, schrieb Stefan Weil:

Quoted 23 lines

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.

---
  readline.c |    3 +++
  1 file changed, 3 insertions(+)
readline.c +3 -0
index a6c0039..646b6e8 100644
@@ -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]);
+    }
  }
 
Quoted 9 lines

readline.c static void readline_completion(ReadLineState *rs) · line 345

Quoted 1 line
readline.c +0 -0
  /* return true if command handled */

Ping?

This patch is for QEMU 1.1, but was not committed up to now.

Regards,
Stefan Weil

Ping^2? Should I send a pull request?
The patch is available at http://patchwork.ozlabs.org/patch/159139/.

Regards,

Stefan Weil

#3 lore raw
Quoted 32 lines · On Sat, 09 Jun 2012 23:36:26 +0200 Stefan Weil <[email protected]> wrote:

Am 22.05.2012 22:24, schrieb Stefan Weil:

Quoted 31 lines

Am 14.05.2012 21:47, schrieb Stefan Weil:

Quoted 16 lines

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.

---
  readline.c |    3 +++
  1 file changed, 3 insertions(+)
readline.c +0 -0
index a6c0039..646b6e8 100644

readline.c static void readline_completion(ReadLineState *rs) · line 345

Quoted 9 lines
readline.c +3 -0
@@ -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 */

Ping?

This patch is for QEMU 1.1, but was not committed up to now.

Quoted 7 lines
Quoted 3 lines

Regards,
Stefan Weil

Ping^2? Should I send a pull request?
The patch is available at http://patchwork.ozlabs.org/patch/159139/.

Applied to the qmp branch, thanks.