* grp/fgetgrent.c (buffer): Make file local variable.
	(free_mem): New function.  Call for malloc debugging.
This commit is contained in:
Ulrich Drepper 1999-06-08 20:25:31 +00:00
parent 4707ba3dde
commit 1dc3d266ef
2 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,8 @@
1999-06-08 Ulrich Drepper <drepper@cygnus.com> 1999-06-08 Ulrich Drepper <drepper@cygnus.com>
* grp/fgetgrent.c (buffer): Make file local variable.
(free_mem): New function. Call for malloc debugging.
* grp/tst_fgetgrent.c (write_users): Correctly generate long line. * grp/tst_fgetgrent.c (write_users): Correctly generate long line.
1999-06-08 Andreas Jaeger <aj@arthur.rhein-neckar.de> 1999-06-08 Andreas Jaeger <aj@arthur.rhein-neckar.de>

View File

@ -26,11 +26,12 @@
/* We need to protect the dynamic buffer handling. */ /* We need to protect the dynamic buffer handling. */
__libc_lock_define_initialized (static, lock); __libc_lock_define_initialized (static, lock);
static char *buffer;
/* Read one entry from the given stream. */ /* Read one entry from the given stream. */
struct group * struct group *
fgetgrent (FILE *stream) fgetgrent (FILE *stream)
{ {
static char *buffer;
static size_t buffer_size; static size_t buffer_size;
static struct group resbuf; static struct group resbuf;
fpos_t pos; fpos_t pos;
@ -85,3 +86,14 @@ fgetgrent (FILE *stream)
return result; return result;
} }
/* Free all resources if necessary. */
static void __attribute__ ((unused))
free_mem (void)
{
if (buffer != NULL)
free (buffer);
}
text_set_element (__libc_subfreeres, free_mem);