------- Comment #2 from kargl at gcc dot gnu dot org 2009-05-26 14:18 ------- (In reply to comment #1) > The following patch to gfc_match_nullify fixes it; however, I think one should > additionally add > > gfc_free_expr (new_st.expr1); > new_st.expr1 = NULL; > gfc_free_expr (new_st.expr2); > new_st.expr2 = NULL; > > to prevent a memory leak. >
AFAICT, there is no leak. gfc_free_statement (gfc_code *p) { if (p->expr1) gfc_free_expr (p->expr1); if (p->expr2) gfc_free_expr (p->expr2); gfc_free_expr (gfc_expr *e) { if (e == NULL) return; if (e->con_by_offset) splay_tree_delete (e->con_by_offset); free_expr0 (e); gfc_free (e); } The last gfc_free(e) should prevent a leak. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40246