wlr_virtual_keyboard: fix fd leak

This commit is contained in:
Daniel De Graaf 2020-08-09 13:31:53 -04:00 committed by Simon Ser
parent 7e990a2991
commit c236f60bb6
1 changed files with 3 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#define _POSIX_C_SOURCE 199309L #define _POSIX_C_SOURCE 199309L
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
#include <wlr/types/wlr_virtual_keyboard_v1.h> #include <wlr/types/wlr_virtual_keyboard_v1.h>
@ -72,12 +73,14 @@ static void virtual_keyboard_keymap(struct wl_client *client,
keyboard->has_keymap = true; keyboard->has_keymap = true;
xkb_keymap_unref(keymap); xkb_keymap_unref(keymap);
xkb_context_unref(context); xkb_context_unref(context);
close(fd);
return; return;
keymap_fail: keymap_fail:
fd_fail: fd_fail:
xkb_context_unref(context); xkb_context_unref(context);
context_fail: context_fail:
wl_client_post_no_memory(client); wl_client_post_no_memory(client);
close(fd);
} }
static void virtual_keyboard_key(struct wl_client *client, static void virtual_keyboard_key(struct wl_client *client,