aboutsummaryrefslogtreecommitdiff
path: root/examples/simple.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-09-03 08:26:59 +0200
committerGitHub <noreply@github.com>2018-09-03 08:26:59 +0200
commitd22431d969d055b4ef82b21daa6f7b6dfb3e1f2b (patch)
tree3521f599cb0f7e16e7c659726ca7fbd0da8dde03 /examples/simple.c
parent6946134883bcbb419f898cbbc87bfa345d070f3c (diff)
parent9f511ae942b27c0012cfa39d9950326d7e79f120 (diff)
Merge pull request #1228 from arandomhuman/misc-mem
Miscellaneous memory leak fixes
Diffstat (limited to 'examples/simple.c')
-rw-r--r--examples/simple.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/simple.c b/examples/simple.c
index 1125bd2a..e1c10906 100644
--- a/examples/simple.c
+++ b/examples/simple.c
@@ -141,8 +141,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;
default: