menu: fix leak in update_client_send_to_menu()

This commit is contained in:
Johan Malm 2025-08-13 21:37:51 +01:00 committed by Johan Malm
parent 6fe61f8846
commit 8bcea29a1c

View file

@ -844,8 +844,8 @@ update_client_send_to_menu(struct server *server)
* <action name="SendToDesktop"><follow> is true by default so * <action name="SendToDesktop"><follow> is true by default so
* GoToDesktop will be called as part of the action. * GoToDesktop will be called as part of the action.
*/ */
struct buf buf = BUF_INIT;
wl_list_for_each(workspace, &server->workspaces.all, link) { wl_list_for_each(workspace, &server->workspaces.all, link) {
struct buf buf = BUF_INIT;
if (workspace == server->workspaces.current) { if (workspace == server->workspaces.current) {
buf_add_fmt(&buf, ">%s<", workspace->name); buf_add_fmt(&buf, ">%s<", workspace->name);
} else { } else {
@ -859,6 +859,7 @@ update_client_send_to_menu(struct server *server)
buf_clear(&buf); buf_clear(&buf);
} }
buf_reset(&buf);
separator_create(menu, ""); separator_create(menu, "");
struct menuitem *item = item_create(menu, struct menuitem *item = item_create(menu,