1. Use MemoryAllocationLib to replace boot services memory services functions in EdkModulePkg.
2. Added NULL pointer check before calling FreePool () to fix bugs when free memory. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2513 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
reclaim.c
|
||||
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Handles non-volatile variable store garbage collection, using FTW
|
||||
(Fault Tolerant Write) protocol.
|
||||
|
||||
@@ -82,7 +82,7 @@ GetFvbHandleByAddress (
|
||||
}
|
||||
}
|
||||
|
||||
gBS->FreePool (HandleBuffer);
|
||||
FreePool (HandleBuffer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -216,8 +216,8 @@ Returns:
|
||||
// Prepare for the variable data
|
||||
//
|
||||
FtwBufferSize = ((VARIABLE_STORE_HEADER *) ((UINTN) VariableBase))->Size;
|
||||
Status = gBS->AllocatePool (EfiRuntimeServicesData, FtwBufferSize, (VOID **) &FtwBuffer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FtwBuffer = AllocateRuntimePool (FtwBufferSize);
|
||||
if (FtwBuffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
@@ -236,6 +236,6 @@ Returns:
|
||||
FtwBuffer
|
||||
);
|
||||
|
||||
gBS->FreePool (FtwBuffer);
|
||||
FreePool (FtwBuffer);
|
||||
return Status;
|
||||
}
|
||||
|
Reference in New Issue
Block a user