/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */
VOID* EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */
VOID* EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
{
  VOID  *NewBuffer;
  NewBuffer = AllocatePool (NewSize);
  if (NewBuffer == NULL) {
    return NULL;
  }
  if (OldBuffer != NULL) {
    if (OldSize > 0) {
      CopyMem (NewBuffer, OldBuffer, OldSize);
    }
    FreePool (OldBuffer);
  }
  return NewBuffer;
}