aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-06-08 20:25:31 +0000
committerUlrich Drepper <drepper@redhat.com>1999-06-08 20:25:31 +0000
commit1dc3d266ef6f3d8b0091ebfbb982859ca35ead50 (patch)
tree9303e136bf25a668b6fa1176da59f2bc2893c03d
parent4707ba3dde687989ed625e1a1a062e527ac79342 (diff)
downloadglibc-1dc3d266ef6f3d8b0091ebfbb982859ca35ead50.zip
glibc-1dc3d266ef6f3d8b0091ebfbb982859ca35ead50.tar.gz
glibc-1dc3d266ef6f3d8b0091ebfbb982859ca35ead50.tar.bz2
Update.
* grp/fgetgrent.c (buffer): Make file local variable. (free_mem): New function. Call for malloc debugging.
-rw-r--r--ChangeLog3
-rw-r--r--grp/fgetgrent.c14
2 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 65dca79..8ae24b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
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.
1999-06-08 Andreas Jaeger <aj@arthur.rhein-neckar.de>
diff --git a/grp/fgetgrent.c b/grp/fgetgrent.c
index ac8d093..d2e3de6 100644
--- a/grp/fgetgrent.c
+++ b/grp/fgetgrent.c
@@ -26,11 +26,12 @@
/* We need to protect the dynamic buffer handling. */
__libc_lock_define_initialized (static, lock);
+static char *buffer;
+
/* Read one entry from the given stream. */
struct group *
fgetgrent (FILE *stream)
{
- static char *buffer;
static size_t buffer_size;
static struct group resbuf;
fpos_t pos;
@@ -85,3 +86,14 @@ fgetgrent (FILE *stream)
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);