A basic question about linked list



Hi,

I want to know the correct procedure for deallocating memory that gets
allocated during creation of a linked list (I am using CVF).

I want to create a linked list of "segments" which goes something like
this -

type face_1d
double precision, dimension(2):: pt1, pt2
end type

type curve
type(face_1d):: facet
type(curve), pointer::next
end type curve
..............................
in main , I have

type(curve), pointer:: head
type(curve), pointer::tail
type(curve), pointer::ptr_temp

Now I write some code to populate the linked list. First element is
pointed to by head and the last is tail. Then do some calculations.

Later in the code, I want to re-define the curve identified by
"head" (e.g. all together different set of segments). What do I need
to do to deallocate memory correctly for the previously defined curve
before starting to define the new curve?

This may be a very basic question for linked list. Pardon my
ignorance. Any help is greatly appreciated.
Thanks.
Veda.

.