diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-08-16 07:21:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-16 07:21:27 -0400 |
commit | 2164adc5136e91e5d9d5d0f67f792185f1c66658 (patch) | |
tree | 8e83344aeadb70c3449baa663d02d7013c542d62 /backend/libinput/events.c | |
parent | 19d6442f52743d50d10c796d7146f58c251f67fe (diff) | |
parent | 901c14c409e6e8143ade06a7478241e558cfb79c (diff) |
Merge pull request #95 from 4e554c4c/list_api
Prevent alloc errors from crashing in `list_t`
Diffstat (limited to 'backend/libinput/events.c')
-rw-r--r-- | backend/libinput/events.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/backend/libinput/events.c b/backend/libinput/events.c index dc5e4cb1..2a396536 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -44,11 +44,14 @@ static struct wlr_input_device *allocate_device( return NULL; } struct wlr_input_device *wlr_dev = &wlr_libinput_dev->wlr_input_device; + if (list_add(wlr_devices, wlr_dev) == -1) { + free(wlr_libinput_dev); + return NULL; + } wlr_libinput_dev->handle = libinput_dev; libinput_device_ref(libinput_dev); wlr_input_device_init(wlr_dev, type, &input_device_impl, name, vendor, product); - list_add(wlr_devices, wlr_dev); return wlr_dev; } |