aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@gmail.com>2022-02-15 09:03:05 +0100
committerPeter Maydell <peter.maydell@linaro.org>2022-02-21 13:30:21 +0000
commitca511604925eef8572e22ecbf0d3c758d7277924 (patch)
tree18c6a8a0d849f676ac72c7884d9f89d66efc251e
parentb597278d5780b15759c31a944f21f8b1491902fe (diff)
ui/cocoa: Fix the leak of qemu_console_get_label
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20220215080307.69550-14-f4bug@amsat.org Message-Id: <20220213021329.2066-1-akihiko.odaki@gmail.com> [PMD: Use g_autofree, suggested by Zoltan BALATON] Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--ui/cocoa.m4
1 files changed, 3 insertions, 1 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index f585a5c177..a8f1cdaf92 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1674,7 +1674,9 @@ 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)];
+ g_autofree char *label = qemu_console_get_label(console);
+
+ return [NSString stringWithUTF8String:label];
}
/* Add an entry to the View menu for each console */