Handle some more memory allocation failures

This commit is contained in:
Drew DeVault 2016-12-15 18:03:59 -05:00
parent d75a747a3d
commit 8cef81d6f2
5 changed files with 25 additions and 1 deletions

View file

@ -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);