mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
Prevent alloc errors from crashing in list_t
This commit changes the `list_t` api so that alloc errors can be
detected and worked around. Also fixes errors not found in 5cc7342
This commit is contained in:
parent
19d6442f52
commit
901c14c409
8 changed files with 103 additions and 25 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue