Revision: 14388
          http://edk2.svn.sourceforge.net/edk2/?rev=14388&view=rev
Author:   lgao4
Date:     2013-05-27 05:45:35 +0000 (Mon, 27 May 2013)
Log Message:
-----------
Fix the issue that FreePool is too early in FirmwarePerformanceDxe.

Signed-off-by: Liming Gao <[email protected]>
Reviewed-by: Star Zeng <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c

Modified: 
trunk/edk2/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
===================================================================
--- 
trunk/edk2/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
     2013-05-24 02:48:40 UTC (rev 14387)
+++ 
trunk/edk2/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
     2013-05-27 05:45:35 UTC (rev 14388)
@@ -356,14 +356,15 @@
   //
   // Collect boot records from SMM drivers.
   //
-  SmmBootRecordCommBuffer = AllocateZeroPool (SMM_BOOT_RECORD_COMM_SIZE);
-  ASSERT (SmmBootRecordCommBuffer != NULL);
-  SmmCommData = NULL;
+  SmmBootRecordCommBuffer = NULL;
+  SmmCommData             = NULL;
   Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID 
**) &Communication);
   if (!EFI_ERROR (Status)) {
     //
     // Initialize communicate buffer 
     //
+    SmmBootRecordCommBuffer = AllocateZeroPool (SMM_BOOT_RECORD_COMM_SIZE);
+    ASSERT (SmmBootRecordCommBuffer != NULL);
     SmmCommBufferHeader = (EFI_SMM_COMMUNICATE_HEADER*)SmmBootRecordCommBuffer;
     SmmCommData = (SMM_BOOT_RECORD_COMMUNICATE*)SmmCommBufferHeader->Data;
     ZeroMem((UINT8*)SmmCommData, sizeof(SMM_BOOT_RECORD_COMMUNICATE));
@@ -393,7 +394,6 @@
       ASSERT_EFI_ERROR(SmmCommData->ReturnStatus);
     }
   }
-  FreePool (SmmBootRecordCommBuffer);
 
   //
   // Prepare memory for Boot Performance table.
@@ -440,6 +440,9 @@
     if (SmmCommData != NULL && SmmCommData->BootRecordData != NULL) {
       FreePool (SmmCommData->BootRecordData);
     }
+    if (SmmBootRecordCommBuffer != NULL) {
+      FreePool (SmmBootRecordCommBuffer);
+    }
     if (mAcpiS3PerformanceTable != NULL) {
       FreePages (mAcpiS3PerformanceTable, EFI_SIZE_TO_PAGES (sizeof 
(S3_PERFORMANCE_TABLE)));
     }
@@ -470,6 +473,10 @@
     mAcpiBootPerformanceTable->Header.Length = (UINT32) 
(mAcpiBootPerformanceTable->Header.Length + SmmCommData->BootRecordSize);
     BootPerformanceData = BootPerformanceData + SmmCommData->BootRecordSize;
   }
+  if (SmmBootRecordCommBuffer != NULL) {
+    FreePool (SmmBootRecordCommBuffer);
+  }
+
   //
   // Save Boot Performance Table address to Variable for use in S4 resume.
   //

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


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to