diff --git a/MdePkg/Include/Library/MemoryAllocationLib.h b/MdePkg/Include/Library/MemoryAllocationLib.h index 74f7673cd7..8cc93f2bae 100644 --- a/MdePkg/Include/Library/MemoryAllocationLib.h +++ b/MdePkg/Include/Library/MemoryAllocationLib.h @@ -83,7 +83,8 @@ AllocateReservedPages ( Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer must have been allocated on a previous call to the page allocation services of the Memory - Allocation Library. + Allocation Library. If it is not possible to free allocated pages, then this function will + peform no actions. If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). @@ -178,7 +179,8 @@ AllocateAlignedReservedPages ( Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer must have been allocated on a previous call to the aligned page allocation services of the Memory - Allocation Library. + Allocation Library. If it is not possible to free allocated pages, then this function will + peform no actions. If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). @@ -470,7 +472,8 @@ ReallocateReservedPool ( Memory Allocation Library. Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the - pool allocation services of the Memory Allocation Library. + pool allocation services of the Memory Allocation Library. If it is not possible to free pool + resources, then this function will peform no actions. If Buffer was not allocated with a pool allocation function in the Memory Allocation Library, then ASSERT(). diff --git a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c index f9e723ef2f..4e5f8fadd4 100644 --- a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c +++ b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c @@ -128,7 +128,8 @@ AllocateReservedPages ( Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer must have been allocated on a previous call to the page allocation services of the Memory - Allocation Library. + Allocation Library. If it is not possible to free allocated pages, then this function will + peform no actions. If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). @@ -145,6 +146,7 @@ FreePages ( IN UINTN Pages ) { + ASSERT (Pages != 0); // // PEI phase does not support to free pages, so leave it as NOP. // @@ -288,7 +290,8 @@ AllocateAlignedReservedPages ( Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer must have been allocated on a previous call to the aligned page allocation services of the Memory - Allocation Library. + Allocation Library. If it is not possible to free allocated pages, then this function will + peform no actions. If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). @@ -305,6 +308,7 @@ FreeAlignedPages ( IN UINTN Pages ) { + ASSERT (Pages != 0); // // PEI phase does not support to free pages, so leave it as NOP. // @@ -775,7 +779,8 @@ ReallocateReservedPool ( Memory Allocation Library. Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the - pool allocation services of the Memory Allocation Library. + pool allocation services of the Memory Allocation Library. If it is not possible to free pool + resources, then this function will peform no actions. If Buffer was not allocated with a pool allocation function in the Memory Allocation Library, then ASSERT(). diff --git a/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c index 2a9f128424..08bb2921ab 100644 --- a/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c +++ b/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c @@ -127,7 +127,8 @@ AllocateReservedPages ( Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer must have been allocated on a previous call to the page allocation services of the Memory - Allocation Library. + Allocation Library. If it is not possible to free allocated pages, then this function will + peform no actions. If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). @@ -323,7 +324,8 @@ AllocateAlignedReservedPages ( Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer must have been allocated on a previous call to the aligned page allocation services of the Memory - Allocation Library. + Allocation Library. If it is not possible to free allocated pages, then this function will + peform no actions. If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). @@ -792,7 +794,8 @@ ReallocateReservedPool ( Memory Allocation Library. Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the - pool allocation services of the Memory Allocation Library. + pool allocation services of the Memory Allocation Library. If it is not possible to free pool + resources, then this function will peform no actions. If Buffer was not allocated with a pool allocation function in the Memory Allocation Library, then ASSERT().