https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78618
--- Comment #19 from janus at gcc dot gnu.org --- (In reply to Steve Kargl from comment #18) > On Sun, Dec 04, 2016 at 04:24:21PM +0000, janus at gcc dot gnu.org wrote: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78618 > > > > Maybe one can instead try to nullify the memory in gfc_free charlen, so > > that we > > at least know that cl->lengh is not a valid pointer? (Something similar is > > also > > done in gfc_free_expr / free_expr0 in expr.c.) > > > > Index: symbol.c > > =================================================================== > > --- symbol.c (revision 243224) > > +++ symbol.c (working copy) > > @@ -3838,6 +3838,7 @@ gfc_free_charlen (gfc_charlen *cl, gfc_charlen *en > > > > cl2 = cl->next; > > gfc_free_expr (cl->length); > > + memset (cl, '\0', sizeof (gfc_charlen)); > > free (cl); > > } > > } > > > > Doesn't that leak memory? The 'free(cl)' in the line > after memset() should be a NOP, so whatever cl pointed > to before the memset() is leaked. I guess memset does not nullify the pointer 'cl' itself, but the memory it points to, right? (As mentioned, we do the same thing in gfc_free_expr.) > Hmmm, doesn't seem to help. Too bad :(