From 4e17605909eddc8392aa47fe76cf345e802c8e2f Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Thu, 12 Dec 1996 23:52:34 +0000 Subject: Don't free the line buffer, since getttynam(3) might still reference it. Closes PR # bin/2196: Bug in src/libc/gen/gettty... Submitted by: davidn@blaze.net.au (David Nugent) --- lib/libc/gen/getttyent.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/gen/getttyent.c b/lib/libc/gen/getttyent.c index 2cd965dceab5..5d40ac9941f6 100644 --- a/lib/libc/gen/getttyent.c +++ b/lib/libc/gen/getttyent.c @@ -207,11 +207,10 @@ endttyent() { int rval; - if (line) { - free(line); - line = NULL; - lbsize = 0; - } + /* + * NB: Don't free `line' because getttynam() + * may still be referencing it + */ if (tf) { rval = (fclose(tf) != EOF); tf = NULL; -- cgit v1.2.3