summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c6
-rw-r--r--MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c3
2 files changed, 9 insertions, 0 deletions
diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
index da6ce75b3a..b8a665cff5 100644
--- a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
+++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
@@ -394,6 +394,12 @@ ErrorExit:
if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) {
gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx);
}
+ if (UsbKeyboardDevice->KeyboardLayoutEvent != NULL) {
+ gBS->CloseEvent (UsbKeyboardDevice->KeyboardLayoutEvent);
+ }
+ if (UsbKeyboardDevice->KeyConvertionTable != NULL) {
+ FreePool (UsbKeyboardDevice->KeyConvertionTable);
+ }
FreePool (UsbKeyboardDevice);
UsbKeyboardDevice = NULL;
}
diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
index 51ab18223e..40f9a5633a 100644
--- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
+++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
@@ -598,6 +598,9 @@ SetKeyboardLayoutEvent (
UINT8 KeyCode;
UsbKeyboardDevice = (USB_KB_DEV *) Context;
+ if (UsbKeyboardDevice->Signature != USB_KB_DEV_SIGNATURE) {
+ return;
+ }
//
// Try to get current keyboard layout from HII database