[Bug jit/63854] Fix memory leaks seen in JIT

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 12 19:59:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854

--- Comment #30 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Binderman from comment #29)
> Similar thing in the same area, caught using static analyser cppcheck:
> 
> [gcc/jit/jit-playback.c:1791]: (error) Resource leak: f_in
> 
> Source code is
> 
>   if (!feof (f_in))
>     {
>       add_error (NULL, "error reading from %s", path);
>       free (result);
>       return NULL;
>     }
> 
>   fclose (f_in);
> 
> It looks to me like a call to fclose needs to happen just before
> the return.

Thanks.  I've fixed this in r219487.



More information about the Gcc-bugs mailing list