diff options
author | Drew DeVault <[email protected]> | 2016-12-15 18:03:59 -0500 |
---|---|---|
committer | Drew DeVault <[email protected]> | 2016-12-15 19:01:41 -0500 |
commit | 8cef81d6f23adb66873ee5fd84aa7180b22624f2 (patch) | |
tree | 0739dff1b879b5a674dbd56e44ad4f4a44e941c7 /sway/handlers.c | |
parent | d75a747a3ddc99f258025a923de1cf4821bf3115 (diff) |
Handle some more memory allocation failures
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 9 |
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) { static bool handle_input_created(struct libinput_device *device) { const char *identifier = libinput_dev_unique_id(device); + if (!identifier) { + sway_log(L_ERROR, "Unable to allocate unique name for input device %p", + device); + return true; + } sway_log(L_INFO, "Found input device (%s)", identifier); list_add(input_devices, device); @@ -402,6 +407,10 @@ static bool handle_view_created(wlc_handle handle) { } else { swayc_t *output = swayc_parent_by_type(focused, C_OUTPUT); wlc_handle *h = malloc(sizeof(wlc_handle)); + if (!h) { + sway_log(L_ERROR, "Unable to allocate window handle, view handler bailing out"); + return true; + } *h = handle; sway_log(L_DEBUG, "Adding unmanaged window %p to %p", h, output->unmanaged); list_add(output->unmanaged, h); |