free allocated memory in error handler.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9173 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
eric_tian 2009-08-24 06:24:24 +00:00
parent 95ba3c4150
commit 16a97771ad
2 changed files with 9 additions and 0 deletions

View File

@ -394,6 +394,12 @@ ErrorExit:
if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) { if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) {
gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx); gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx);
} }
if (UsbKeyboardDevice->KeyboardLayoutEvent != NULL) {
gBS->CloseEvent (UsbKeyboardDevice->KeyboardLayoutEvent);
}
if (UsbKeyboardDevice->KeyConvertionTable != NULL) {
FreePool (UsbKeyboardDevice->KeyConvertionTable);
}
FreePool (UsbKeyboardDevice); FreePool (UsbKeyboardDevice);
UsbKeyboardDevice = NULL; UsbKeyboardDevice = NULL;
} }

View File

@ -598,6 +598,9 @@ SetKeyboardLayoutEvent (
UINT8 KeyCode; UINT8 KeyCode;
UsbKeyboardDevice = (USB_KB_DEV *) Context; UsbKeyboardDevice = (USB_KB_DEV *) Context;
if (UsbKeyboardDevice->Signature != USB_KB_DEV_SIGNATURE) {
return;
}
// //
// Try to get current keyboard layout from HII database // Try to get current keyboard layout from HII database