Hi all,
this patch fixes a number of memory leaks with gfc_charlen. All
gfc_charlen structures are normally put into a linked list in their
respective namespace (ns->cl_list). When the namespace is cleaned up
in the end, this list of gfc_charlen's is also freed. Any gfc_charlen
which is not inside such a list will be a memory leak, since it is
never deallocated.
When working on PR 40822 (where I introduced a function
'gfc_new_charlen' which makes sure the charlen is correctly put into a
ns->cl_list), I noticed a couple of places where a gfc_charlen is not
put into such a list. I checked these, and concluded that indeed all
of them seem to be memory leaks. This patch plugs these leaks and adds
a new argument to 'gfc_new_charlen', so that this function can also be
used to create a new gfc_charlen as a copy of an existing one.
Regtested on x86_64-unknown-linux-gnu. Ok for trunk?