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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
(In reply to Jerry DeLisle from comment #2)
> (In reply to anlauf from comment #1)
> > Some context:
> > 
> > /* free_format_data()-- Free all allocated format data.  */
> > 
> > void
> > free_format_data (format_data *fmt)
> > {
> > ...
> >   free (fmt);
> >   fmt = NULL;
> > }
> > 
> > It looks like the intent was to nullify the pointer in the caller,
> > but this does not work the way it is coded.
> 
> The intent was to set it to NULL so that if the function is called again it
> will do nothing.
> 
> void
> free_format_data (format_data *fmt)
> {
>   fnode_array *fa, *fa_next;
>   fnode *fnp;
> 
>   if (fmt == NULL)
>     return;
> ...
> 
> to avoid attempting to free the format hash table if it has already been
> freed.

Since we are stuck with C in libgfortran, a possible solution is:

void
free_format_data (format_data **fmt)

and adaptation of the remaining code.

What do you think?

Reply via email to