From e7356456ed980db73b21df22d5405c1aaeeca003 Mon Sep 17 00:00:00 2001 From: Tai-hwa Liang Date: Thu, 22 Nov 2007 01:51:46 +0000 Subject: [PATCH] Nuking the temporary pointer once it is properly tracked in local storage. This should fix the double free() bug where there's no tailing newline(\n) character: current# echo -n test | tail testAssertion failed: (run->magic == ARENA_RUN_MAGIC), function arena_dalloc, file /usr/src/lib/libc/stdlib/malloc.c, line 2448. Abort (core dumped) Reviewed by: kib MFC after: 3 days --- usr.bin/tail/read.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.bin/tail/read.c b/usr.bin/tail/read.c index 272f1026bc9..d290ed41da1 100644 --- a/usr.bin/tail/read.c +++ b/usr.bin/tail/read.c @@ -184,6 +184,7 @@ lines(FILE *fp, off_t off) } if (cnt) { llines[recno].l = sp; + sp = NULL; llines[recno].len = cnt; if (++recno == off) { wrap = 1;