summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-10-21 23:56:23 +0000
committerjoerg <joerg@FreeBSD.org>1996-10-21 23:56:23 +0000
commit0e1fd8a8f77f414e126b68b4c5cb884edfe9c33f (patch)
tree4b22b758119f1269569742b044cd5130e15efe74 /lib
parent179cbc5d48c62f73496a417257fe8b97143988b9 (diff)
downloadFreeBSD-src-0e1fd8a8f77f414e126b68b4c5cb884edfe9c33f.zip
FreeBSD-src-0e1fd8a8f77f414e126b68b4c5cb884edfe9c33f.tar.gz
Fix a potential memory leak i've introduced with my recent patch.
Reviewed by: bde
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/getttyent.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/gen/getttyent.c b/lib/libc/gen/getttyent.c
index a4b31aa..2cd965d 100644
--- a/lib/libc/gen/getttyent.c
+++ b/lib/libc/gen/getttyent.c
@@ -82,11 +82,11 @@ getttyent()
while (!index(p, '\n')) {
i = strlen(p);
lbsize += MALLOCCHUNK;
- if ((line = realloc(line, lbsize)) == NULL) {
+ if ((p = realloc(line, lbsize)) == NULL) {
(void)endttyent();
return (NULL);
}
- p = line;
+ line = p;
if (!fgets(&line[i], lbsize - i, tf))
return (NULL);
}
OpenPOWER on IntegriCloud