diff options
author | emersion <contact@emersion.fr> | 2018-09-03 08:26:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-03 08:26:59 +0200 |
commit | d22431d969d055b4ef82b21daa6f7b6dfb3e1f2b (patch) | |
tree | 3521f599cb0f7e16e7c659726ca7fbd0da8dde03 /examples/touch.c | |
parent | 6946134883bcbb419f898cbbc87bfa345d070f3c (diff) | |
parent | 9f511ae942b27c0012cfa39d9950326d7e79f120 (diff) |
Merge pull request #1228 from arandomhuman/misc-mem
Miscellaneous memory leak fixes
Diffstat (limited to 'examples/touch.c')
-rw-r--r-- | examples/touch.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/touch.c b/examples/touch.c index ba5d1e34..9ed20a28 100644 --- a/examples/touch.c +++ b/examples/touch.c @@ -210,8 +210,14 @@ void new_input_notify(struct wl_listener *listener, void *data) { wlr_log(WLR_ERROR, "Failed to create XKB context"); exit(1); } - wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context, - &rules, XKB_KEYMAP_COMPILE_NO_FLAGS)); + struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules, + XKB_KEYMAP_COMPILE_NO_FLAGS); + if (!keymap) { + wlr_log(WLR_ERROR, "Failed to create XKB keymap"); + exit(1); + } + wlr_keyboard_set_keymap(device->keyboard, keymap); + xkb_keymap_unref(keymap); xkb_context_unref(context); break; case WLR_INPUT_DEVICE_TOUCH:; |