Fix buffer leaks in fgetln

Cache the size and the buffer allocated by getline as static variables.
This commit is contained in:
Guillem Jover 2009-05-15 21:26:09 +02:00
parent deb9f56ceb
commit 74ae34e792

View File

@ -34,8 +34,8 @@
char * char *
fgetln (FILE *stream, size_t *len) fgetln (FILE *stream, size_t *len)
{ {
char *line = NULL; static char *line = NULL;
size_t line_len = 0; static size_t line_len = 0;
ssize_t nread; ssize_t nread;
nread = getline(&line, &line_len, stream); nread = getline(&line, &line_len, stream);