about summary refs log tree commit diff
path: root/nss
diff options
context:
space:
mode:
Diffstat (limited to 'nss')
-rw-r--r--nss/getXXbyYY.c12
-rw-r--r--nss/getXXent.c12
-rw-r--r--nss/nsswitch.c5
3 files changed, 3 insertions, 26 deletions
diff --git a/nss/getXXbyYY.c b/nss/getXXbyYY.c
index ee6f640002..a9f1cfd5c8 100644
--- a/nss/getXXbyYY.c
+++ b/nss/getXXbyYY.c
@@ -86,7 +86,7 @@ extern int INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf,
 __libc_lock_define_initialized (static, lock);
 
 /* This points to the static buffer used.  */
-static char *buffer;
+libc_freeres_ptr (static char *buffer);
 
 
 LOOKUP_TYPE *
@@ -162,13 +162,3 @@ done:
 
   return result;
 }
-
-
-/* Free all resources if necessary.  */
-static void __attribute__ ((unused))
-free_mem (void)
-{
-  free (buffer);
-}
-
-text_set_element (__libc_subfreeres, free_mem);
diff --git a/nss/getXXent.c b/nss/getXXent.c
index d4a29ce46a..ebe6fff5f0 100644
--- a/nss/getXXent.c
+++ b/nss/getXXent.c
@@ -63,7 +63,7 @@ extern int INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer,
 __libc_lock_define_initialized (static, lock);
 
 /* This points to the static buffer used.  */
-static char *buffer;
+libc_freeres_ptr (static char *buffer);
 
 
 LOOKUP_TYPE *
@@ -87,13 +87,3 @@ GETFUNC_NAME (void)
   __set_errno (save);
   return result;
 }
-
-
-/* Free all resources if necessary.  */
-static void __attribute__ ((unused))
-free_mem (void)
-{
-  free (buffer);
-}
-
-text_set_element (__libc_subfreeres, free_mem);
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index ca411b2cdc..1b3bb23e0b 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -697,8 +697,7 @@ nss_new_service (name_database *database, const char *name)
 
 
 /* Free all resources if necessary.  */
-static void __attribute__ ((unused))
-free_mem (void)
+libc_freeres_fn (free_mem)
 {
   name_database *top = service_table;
   name_database_entry *entry;
@@ -745,5 +744,3 @@ free_mem (void)
 
   free (top);
 }
-
-text_set_element (__libc_subfreeres, free_mem);