/* Clears all data and segments that are currently present in the linked list.  */
void FirmwareClearData(void)
/* Clears all data and segments that are currently present in the linked list.  */
void FirmwareClearData(void)
{
  tFirmwareSegment * currentSegment;
  tFirmwareSegment * segmentToFree;
  if (segmentList != NULL)
  {
    currentSegment = segmentList;
    do 
    {
      segmentToFree = currentSegment;
      currentSegment = currentSegment->next;
      assert(segmentToFree != NULL);
      if (segmentToFree != NULL)
      {
        if (segmentToFree->data != NULL)
        {
          free(segmentToFree->data);
        }
        free(segmentToFree);
      }
    }
    while (currentSegment != NULL);
    segmentList = NULL;
  }
}