summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/usb/usbhid.c
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/drivers/usb/usbhid.c')
-rw-r--r--payloads/libpayload/drivers/usb/usbhid.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/payloads/libpayload/drivers/usb/usbhid.c b/payloads/libpayload/drivers/usb/usbhid.c
index 44be9ce8d9..ee217c36d8 100644
--- a/payloads/libpayload/drivers/usb/usbhid.c
+++ b/payloads/libpayload/drivers/usb/usbhid.c
@@ -169,6 +169,8 @@ usb_hid_init (usbdev_t *dev)
boot_protos[interface->bInterfaceProtocol]);
if (interface->bInterfaceProtocol == hid_boot_proto_keyboard) {
dev->data = malloc (sizeof (usbhid_inst_t));
+ if (!dev->data)
+ usb_fatal("Not enough memory for USB HID device.\n");
printf (" configuring...\n");
usb_hid_set_protocol(dev, interface, hid_proto_boot);
usb_hid_set_idle(dev, interface, 0);