mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-06 13:29:53 -05:00
fix: miss free kb_layout memory
This commit is contained in:
parent
180d75f06e
commit
4c75bb973e
3 changed files with 5 additions and 11 deletions
|
|
@ -671,7 +671,7 @@ void switch_keyboard_layout(const Arg *arg) {
|
|||
}
|
||||
|
||||
// 3. 分配并获取布局缩写
|
||||
char **layout_ids = calloc(num_layouts, sizeof(char *));
|
||||
const char **layout_ids = calloc(num_layouts, sizeof(char *));
|
||||
if (!layout_ids) {
|
||||
wlr_log(WLR_ERROR, "Failed to allocate layout IDs");
|
||||
goto cleanup_context;
|
||||
|
|
@ -743,9 +743,6 @@ void switch_keyboard_layout(const Arg *arg) {
|
|||
xkb_keymap_unref(new_keymap);
|
||||
|
||||
cleanup_layouts:
|
||||
for (int i = 0; i < num_layouts; i++) {
|
||||
free(layout_ids[i]);
|
||||
}
|
||||
free(layout_ids);
|
||||
|
||||
cleanup_context:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue