From: Akihiko Odaki Date: Tue, 15 Feb 2022 08:03:05 +0000 (+0100) Subject: ui/cocoa: Fix the leak of qemu_console_get_label X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ca511604925eef8572e22ecbf0d3c758d7277924;p=qemu.git ui/cocoa: Fix the leak of qemu_console_get_label Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé 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é Signed-off-by: Peter Maydell --- 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 */