This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] PR 40877: memory leaks with gfc_charlen


On 08/06/2009 04:11 AM, Janus Weil wrote:
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?

OK, thanks for patch.

Jerry


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]