]> git.proxmox.com Git - mirror_edk2.git/commitdiff
free allocated memory in error handler.
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 24 Aug 2009 06:24:24 +0000 (06:24 +0000)
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 24 Aug 2009 06:24:24 +0000 (06:24 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9173 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c

index da6ce75b3a8daf59a64d4e3ad453b39ece28cb17..b8a665cff57760ba7456f94544499e33fe96a73f 100644 (file)
@@ -394,6 +394,12 @@ ErrorExit:
     if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) {\r
       gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx);\r
     }\r
+    if (UsbKeyboardDevice->KeyboardLayoutEvent != NULL) {\r
+      gBS->CloseEvent (UsbKeyboardDevice->KeyboardLayoutEvent);\r
+    }\r
+    if (UsbKeyboardDevice->KeyConvertionTable != NULL) {\r
+      FreePool (UsbKeyboardDevice->KeyConvertionTable);\r
+    }\r
     FreePool (UsbKeyboardDevice);\r
     UsbKeyboardDevice = NULL;\r
   }\r
index 51ab18223e5ef2ce50fc64b655094bb29db95d3a..40f9a5633a6e1e247efcad107ea325ccaa7031dd 100644 (file)
@@ -598,6 +598,9 @@ SetKeyboardLayoutEvent (
   UINT8                     KeyCode;\r
 \r
   UsbKeyboardDevice = (USB_KB_DEV *) Context;\r
+  if (UsbKeyboardDevice->Signature != USB_KB_DEV_SIGNATURE) {\r
+    return;\r
+  }\r
 \r
   //\r
   // Try to get current keyboard layout from HII database\r