From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23852 invoked by alias); 26 Nov 2012 10:24:14 -0000 Received: (qmail 23750 invoked by uid 48); 26 Nov 2012 10:23:54 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/55469] memory leak on read with istat.ne.0 Date: Mon, 26 Nov 2012 10:24:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg02373.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55469 --- Comment #3 from Tobias Burnus 2012-11-26 10:23:54 UTC --- Didn't help. The following should work. The crucial part is "free_line". At a glance free_saved(dtp) (here and in comment 2) seems also to be sensible, but one should read through the file to check that it is indeed correct - and to find other places where free_line is missing. --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -1757,8 +1757,9 @@ read_real (st_parameter_dt *dtp, void * dest, int length) bad_real: + free_line (dtp); + free_saved (dtp); if (nml_bad_return (dtp, c)) return; - free_saved (dtp); if (c == EOF) {