//\r
KeyCode = EfiKeyToUsbKeyCodeConvertionTable [(UINT8) (TempKey.Key)];\r
TableEntry = GetKeyDescriptor (UsbKeyboardDevice, KeyCode);\r
+ if (TableEntry == NULL) {\r
+ ReleaseKeyboardLayoutResources (UsbKeyboardDevice);\r
+ FreePool (KeyboardLayout);\r
+ return;\r
+ }\r
CopyMem (TableEntry, KeyDescriptor, sizeof (EFI_KEY_DESCRIPTOR));\r
\r
//\r
// For non-spacing key, create the list with a non-spacing key followed by physical keys.\r
//\r
if (TempKey.Modifier == EFI_NS_KEY_MODIFIER) {\r
- UsbNsKey = AllocatePool (sizeof (USB_NS_KEY));\r
+ UsbNsKey = AllocateZeroPool (sizeof (USB_NS_KEY));\r
ASSERT (UsbNsKey != NULL);\r
\r
//\r