[Patch, Fortran] PR 40877: memory leaks with gfc_charlen
Janus Weil
janus@gcc.gnu.org
Mon Aug 17 10:36:00 GMT 2009
2009/8/16 Jerry DeLisle <jvdelisle@verizon.net>:
> 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.
Thanks for the review. Committed as r150823.
Cheers,
Janus
More information about the Fortran
mailing list