summaryrefslogtreecommitdiff
path: root/sway/input.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2016-12-15 18:03:59 -0500
committerDrew DeVault <[email protected]>2016-12-15 19:01:41 -0500
commit8cef81d6f23adb66873ee5fd84aa7180b22624f2 (patch)
tree0739dff1b879b5a674dbd56e44ad4f4a44e941c7 /sway/input.c
parentd75a747a3ddc99f258025a923de1cf4821bf3115 (diff)
Handle some more memory allocation failures
Diffstat (limited to 'sway/input.c')
-rw-r--r--sway/input.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sway/input.c b/sway/input.c
index acd69a6b..61757ab8 100644
--- a/sway/input.c
+++ b/sway/input.c
@@ -45,6 +45,10 @@ char *libinput_dev_unique_id(struct libinput_device *device) {
int len = strlen(name) + sizeof(char) * 6;
char *identifier = malloc(len);
+ if (!identifier) {
+ sway_log(L_ERROR, "Unable to allocate unique input device name");
+ return NULL;
+ }
const char *fmt = "%d:%d:%s";
snprintf(identifier, len, fmt, vendor, product, name);