summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authoravatar <avatar@FreeBSD.org>2007-11-22 01:51:46 +0000
committeravatar <avatar@FreeBSD.org>2007-11-22 01:51:46 +0000
commit5fe104598e52f3420ed1a06628822037577d6f88 (patch)
treed5f0cbfddb59ef604b4a36dcf44a54e95b6a2dc3 /usr.bin
parent018efe29f979fab10b25b6928fe98cfde2fe5a80 (diff)
downloadFreeBSD-src-5fe104598e52f3420ed1a06628822037577d6f88.zip
FreeBSD-src-5fe104598e52f3420ed1a06628822037577d6f88.tar.gz
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
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tail/read.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/usr.bin/tail/read.c b/usr.bin/tail/read.c
index 272f102..d290ed4 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;
OpenPOWER on IntegriCloud