]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix memory leak issues in BiosSnp module.
authorElvin Li <elvin.li@intel.com>
Wed, 23 Jul 2014 02:12:37 +0000 (02:12 +0000)
committerli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 23 Jul 2014 02:12:37 +0000 (02:12 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Elvin Li <elvin.li@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15671 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.c
IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c

index 744a7e3453fb65342481722d29394b49c6d54921..05254100f1d465df494e3a75430854d82f3d78d2 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 1999 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -1260,6 +1260,11 @@ Undi16SimpleNetworkLoadUndi (
     if (!EFI_ERROR (Status)) {\r
       return EFI_SUCCESS;\r
     }\r
     if (!EFI_ERROR (Status)) {\r
       return EFI_SUCCESS;\r
     }\r
+    \r
+    //\r
+    // Free resources allocated in LaunchBaseCode\r
+    //\r
+    Undi16SimpleNetworkUnloadUndi (SimpleNetworkDevice);\r
   }\r
 \r
   return EFI_NOT_FOUND;\r
   }\r
 \r
   return EFI_NOT_FOUND;\r
index 0b3543e12c745601d11e6acf6e1c6dcd524f0c22..243048c551cceea8bd927ef8a131f2fd7b117991 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Helper Routines that use a PXE-enabled NIC option ROM.\r
  \r
 /** @file\r
   Helper Routines that use a PXE-enabled NIC option ROM.\r
  \r
-Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -743,6 +743,11 @@ LaunchBaseCode (
     InOutRegs.X.AX)\r
     );\r
 \r
     InOutRegs.X.AX)\r
     );\r
 \r
+  if ((UndiLoaderTable->Status != 0) || (InOutRegs.X.AX != PXENV_EXIT_SUCCESS)) {\r
+    DEBUG ((DEBUG_NET, "LaunchBaseCode exits with error, RomAddress = 0x%X\n\r", RomAddress));\r
+    return EFI_ABORTED;\r
+  }\r
+\r
   DEBUG ((DEBUG_NET, "Now returned from the UNDI code\n\r"));\r
 \r
   DEBUG ((DEBUG_NET, "After the call, we have...\n\r"));\r
   DEBUG ((DEBUG_NET, "Now returned from the UNDI code\n\r"));\r
 \r
   DEBUG ((DEBUG_NET, "After the call, we have...\n\r"));\r
@@ -755,8 +760,9 @@ LaunchBaseCode (
   Pxe = (PXE_T *)(UINTN)((UndiLoaderTable->PXEptr.Segment << 4) + UndiLoaderTable->PXEptr.Offset);\r
   SimpleNetworkDevice->Nii.Id = (UINT64)(UINTN) Pxe;\r
 \r
   Pxe = (PXE_T *)(UINTN)((UndiLoaderTable->PXEptr.Segment << 4) + UndiLoaderTable->PXEptr.Offset);\r
   SimpleNetworkDevice->Nii.Id = (UINT64)(UINTN) Pxe;\r
 \r
+  gBS->FreePool (Buffer);\r
+\r
   //\r
   //\r
-  //  FreePool (Buffer);\r
   // paranoia - make sure a valid !PXE structure\r
   //\r
   if (CompareMem (Pxe->Signature, PXE_SIG, sizeof Pxe->Signature) != 0) {\r
   // paranoia - make sure a valid !PXE structure\r
   //\r
   if (CompareMem (Pxe->Signature, PXE_SIG, sizeof Pxe->Signature) != 0) {\r