]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Misc.c
Fix memory leak issues in BiosSnp module.
[mirror_edk2.git] / IntelFrameworkModulePkg / Csm / BiosThunk / Snp16Dxe / Misc.c
index 0b3543e12c745601d11e6acf6e1c6dcd524f0c22..243048c551cceea8bd927ef8a131f2fd7b117991 100644 (file)
@@ -1,7 +1,7 @@
 /** @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
@@ -743,6 +743,11 @@ LaunchBaseCode (
     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
@@ -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
+  gBS->FreePool (Buffer);\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