Fix a potential memory leak i've introduced with my recent patch.
Reviewed by: bde
This commit is contained in:
parent
54223c4d83
commit
a098bfd775
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user