summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c')
-rw-r--r--MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
index 000430ae78..fe6121985c 100644
--- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
+++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
@@ -627,13 +627,18 @@ SetKeyboardLayoutEvent (
//
KeyCode = EfiKeyToUsbKeyCodeConvertionTable [(UINT8) (TempKey.Key)];
TableEntry = GetKeyDescriptor (UsbKeyboardDevice, KeyCode);
+ if (TableEntry == NULL) {
+ ReleaseKeyboardLayoutResources (UsbKeyboardDevice);
+ FreePool (KeyboardLayout);
+ return;
+ }
CopyMem (TableEntry, KeyDescriptor, sizeof (EFI_KEY_DESCRIPTOR));
//
// For non-spacing key, create the list with a non-spacing key followed by physical keys.
//
if (TempKey.Modifier == EFI_NS_KEY_MODIFIER) {
- UsbNsKey = AllocatePool (sizeof (USB_NS_KEY));
+ UsbNsKey = AllocateZeroPool (sizeof (USB_NS_KEY));
ASSERT (UsbNsKey != NULL);
//