Fix a potential memory leak i've introduced with my recent patch.

Reviewed by:	bde
This commit is contained in:
Joerg Wunsch 1996-10-21 23:56:23 +00:00
parent 54223c4d83
commit a098bfd775

View File

@ -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);
}