From 8cef81d6f23adb66873ee5fd84aa7180b22624f2 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 15 Dec 2016 18:03:59 -0500 Subject: Handle some more memory allocation failures --- sway/input.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sway/input.c') 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); -- cgit v1.2.3