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@12434 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -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);
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user