qemu-devel
[Top][All Lists]
Advanced

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

[PATCH] ui/cocoa: Fix the leak of qemu_console_get_label


From: Akihiko Odaki
Subject: [PATCH] ui/cocoa: Fix the leak of qemu_console_get_label
Date: Sun, 13 Feb 2022 11:13:29 +0900

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
---
 ui/cocoa.m | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index ac18e14ce01..fdf52a7c2f7 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1680,7 +1680,10 @@ static void create_initial_menus(void)
 /* Returns a name for a given console */
 static NSString * getConsoleName(QemuConsole * console)
 {
-    return [NSString stringWithFormat: @"%s", qemu_console_get_label(console)];
+    char *label = qemu_console_get_label(console);
+    NSString *nslabel = [NSString stringWithUTF8String:label];
+    g_free(label);
+    return nslabel;
 }
 
 /* Add an entry to the View menu for each console */
-- 
2.32.0 (Apple Git-132)




reply via email to

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