http://lists.gnu.org/archive/html/bug-gnu-utils/2014-06/msg00000.html Index: sed-4.2.2/sed/utils.c =================================================================== --- sed-4.2.2.orig/sed/utils.c +++ sed-4.2.2/sed/utils.c @@ -298,8 +298,8 @@ ck_fclose(stream) { if (!stream || stream == cur->fp) { - do_ck_fclose (cur->fp); prev->link = cur->link; + do_ck_fclose (cur->fp); free(cur->name); free(cur); }