diff options
author | joerg <joerg@FreeBSD.org> | 1996-12-12 23:52:34 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1996-12-12 23:52:34 +0000 |
commit | 95f7940131e46ab731963527bb07d1b19471a579 (patch) | |
tree | 743c018bfca007bf8be907099ff9a58abd4fd2c1 /lib | |
parent | 3f86386ca9614ae7d1c70af536c8d16691b45ec2 (diff) | |
download | FreeBSD-src-95f7940131e46ab731963527bb07d1b19471a579.zip FreeBSD-src-95f7940131e46ab731963527bb07d1b19471a579.tar.gz |
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)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/getttyent.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libc/gen/getttyent.c b/lib/libc/gen/getttyent.c index 2cd965d..5d40ac9 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; |