summaryrefslogtreecommitdiffstats
path: root/sway/handlers.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2016-12-15 18:03:59 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-12-15 19:01:41 -0500
commit8cef81d6f23adb66873ee5fd84aa7180b22624f2 (patch)
tree0739dff1b879b5a674dbd56e44ad4f4a44e941c7 /sway/handlers.c
parentHandle config-related allocation failures (diff)
downloadsway-8cef81d6f23adb66873ee5fd84aa7180b22624f2.tar.gz
sway-8cef81d6f23adb66873ee5fd84aa7180b22624f2.tar.zst
sway-8cef81d6f23adb66873ee5fd84aa7180b22624f2.zip
Handle some more memory allocation failures
Diffstat (limited to 'sway/handlers.c')
-rw-r--r--sway/handlers.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sway/handlers.c b/sway/handlers.c
index 23a994b4..3abe2fca 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -123,6 +123,11 @@ static void update_background_geometries(wlc_handle output) {
123 123
124static bool handle_input_created(struct libinput_device *device) { 124static bool handle_input_created(struct libinput_device *device) {
125 const char *identifier = libinput_dev_unique_id(device); 125 const char *identifier = libinput_dev_unique_id(device);
126 if (!identifier) {
127 sway_log(L_ERROR, "Unable to allocate unique name for input device %p",
128 device);
129 return true;
130 }
126 sway_log(L_INFO, "Found input device (%s)", identifier); 131 sway_log(L_INFO, "Found input device (%s)", identifier);
127 132
128 list_add(input_devices, device); 133 list_add(input_devices, device);
@@ -402,6 +407,10 @@ static bool handle_view_created(wlc_handle handle) {
402 } else { 407 } else {
403 swayc_t *output = swayc_parent_by_type(focused, C_OUTPUT); 408 swayc_t *output = swayc_parent_by_type(focused, C_OUTPUT);
404 wlc_handle *h = malloc(sizeof(wlc_handle)); 409 wlc_handle *h = malloc(sizeof(wlc_handle));
410 if (!h) {
411 sway_log(L_ERROR, "Unable to allocate window handle, view handler bailing out");
412 return true;
413 }
405 *h = handle; 414 *h = handle;
406 sway_log(L_DEBUG, "Adding unmanaged window %p to %p", h, output->unmanaged); 415 sway_log(L_DEBUG, "Adding unmanaged window %p to %p", h, output->unmanaged);
407 list_add(output->unmanaged, h); 416 list_add(output->unmanaged, h);