Revision: 15671
          http://sourceforge.net/p/edk2/code/15671
Author:   li-elvin
Date:     2014-07-23 02:12:37 +0000 (Wed, 23 Jul 2014)
Log Message:
-----------
Fix memory leak issues in BiosSnp module.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Elvin Li <elvin...@intel.com>
Reviewed-by: Jeff Fan <jeff....@intel.com>

Modified Paths:
--------------
    trunk/edk2/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.c
    trunk/edk2/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c

Modified: trunk/edk2/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.c
===================================================================
--- trunk/edk2/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.c       
2014-07-22 21:57:01 UTC (rev 15670)
+++ trunk/edk2/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.c       
2014-07-23 02:12:37 UTC (rev 15671)
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 1999 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions
@@ -1260,6 +1260,11 @@
     if (!EFI_ERROR (Status)) {
       return EFI_SUCCESS;
     }
+    
+    //
+    // Free resources allocated in LaunchBaseCode
+    //
+    Undi16SimpleNetworkUnloadUndi (SimpleNetworkDevice);
   }
 
   return EFI_NOT_FOUND;

Modified: trunk/edk2/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c
===================================================================
--- trunk/edk2/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c    
2014-07-22 21:57:01 UTC (rev 15670)
+++ trunk/edk2/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c    
2014-07-23 02:12:37 UTC (rev 15671)
@@ -1,7 +1,7 @@
 /** @file
   Helper Routines that use a PXE-enabled NIC option ROM.
  
-Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions
@@ -743,6 +743,11 @@
     InOutRegs.X.AX)
     );
 
+  if ((UndiLoaderTable->Status != 0) || (InOutRegs.X.AX != 
PXENV_EXIT_SUCCESS)) {
+    DEBUG ((DEBUG_NET, "LaunchBaseCode exits with error, RomAddress = 
0x%X\n\r", RomAddress));
+    return EFI_ABORTED;
+  }
+
   DEBUG ((DEBUG_NET, "Now returned from the UNDI code\n\r"));
 
   DEBUG ((DEBUG_NET, "After the call, we have...\n\r"));
@@ -755,8 +760,9 @@
   Pxe = (PXE_T *)(UINTN)((UndiLoaderTable->PXEptr.Segment << 4) + 
UndiLoaderTable->PXEptr.Offset);
   SimpleNetworkDevice->Nii.Id = (UINT64)(UINTN) Pxe;
 
+  gBS->FreePool (Buffer);
+
   //
-  //  FreePool (Buffer);
   // paranoia - make sure a valid !PXE structure
   //
   if (CompareMem (Pxe->Signature, PXE_SIG, sizeof Pxe->Signature) != 0) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to