summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Csm
diff options
context:
space:
mode:
authorElvin Li <elvin.li@intel.com>2014-07-23 02:12:37 +0000
committerli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>2014-07-23 02:12:37 +0000
commit9f6c5db258aee82f586b5b2858d0d979e89c916b (patch)
tree052e106ff1aff6ba9bc284968595da5f864b302b /IntelFrameworkModulePkg/Csm
parent1c50db8adaf9d5ce071e27a518a46cd363ac5efe (diff)
downloadedk2-9f6c5db258aee82f586b5b2858d0d979e89c916b.zip
edk2-9f6c5db258aee82f586b5b2858d0d979e89c916b.tar.gz
edk2-9f6c5db258aee82f586b5b2858d0d979e89c916b.tar.bz2
Fix memory leak issues in BiosSnp module.
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
Diffstat (limited to 'IntelFrameworkModulePkg/Csm')
-rw-r--r--IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.c7
-rw-r--r--IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c10
2 files changed, 14 insertions, 3 deletions
diff --git a/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.c b/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.c
index 744a7e3..0525410 100644
--- a/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.c
+++ b/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.c
@@ -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 @@ Undi16SimpleNetworkLoadUndi (
if (!EFI_ERROR (Status)) {
return EFI_SUCCESS;
}
+
+ //
+ // Free resources allocated in LaunchBaseCode
+ //
+ Undi16SimpleNetworkUnloadUndi (SimpleNetworkDevice);
}
return EFI_NOT_FOUND;
diff --git a/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c b/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c
index 0b3543e..243048c 100644
--- a/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c
+++ b/IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c
@@ -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 @@ LaunchBaseCode (
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 @@ LaunchBaseCode (
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) {