summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Usb/UsbKbDxe
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-23 07:44:49 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-23 07:44:49 +0000
commitd12c6a78aaa2d5bb841733f9c758821875d07dae (patch)
treebceef1c80c0c00f38793e42a025ab70e935c9e4e /MdeModulePkg/Bus/Usb/UsbKbDxe
parent2256f1f7578365c7d8acadb77a1e95373faed78b (diff)
downloadedk2-platforms-d12c6a78aaa2d5bb841733f9c758821875d07dae.tar.xz
error handling enhancement for possible null pointer dereference
Signed-off-by: erictian Reviewed-by: ydong10 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12437 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Usb/UsbKbDxe')
-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);
//