/* Function used to serialise reads of Allocation Descriptors. */
EFI_STATUS GrowUpBufferToNextAd(IN UDF_FE_RECORDING_FLAGS RecordingFlags, IN VOID *Ad, IN OUT VOID **Buffer, IN UINT64 Length)
/* Function used to serialise reads of Allocation Descriptors. */
EFI_STATUS GrowUpBufferToNextAd(IN UDF_FE_RECORDING_FLAGS RecordingFlags, IN VOID *Ad, IN OUT VOID **Buffer, IN UINT64 Length)
{
  UINT32  ExtentLength;
  ExtentLength = GET_EXTENT_LENGTH (RecordingFlags, Ad);
  if (*Buffer == NULL) {
    *Buffer = AllocatePool (ExtentLength);
    if (*Buffer == NULL) {
      return EFI_OUT_OF_RESOURCES;
    }
  } else {
    *Buffer = ReallocatePool ((UINTN)Length, (UINTN)(Length + ExtentLength), *Buffer);
    if (*Buffer == NULL) {
      return EFI_OUT_OF_RESOURCES;
    }
  }
  return EFI_SUCCESS;
}