From 0e1fd8a8f77f414e126b68b4c5cb884edfe9c33f Mon Sep 17 00:00:00 2001 From: joerg Date: Mon, 21 Oct 1996 23:56:23 +0000 Subject: Fix a potential memory leak i've introduced with my recent patch. Reviewed by: bde --- lib/libc/gen/getttyent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') 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); } -- cgit v1.1