about summary refs log tree commit diff
path: root/crypt
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-15 06:12:25 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-15 06:12:25 +0000
commitb8fd550293431d4df42b281fc868ef0ab80e822b (patch)
treec120161943ff2e764d28b4059e9c2f9d4e7063da /crypt
parenta6bd56c7538360e8eecbe1cafea655cf890fb7e9 (diff)
downloadglibc-b8fd550293431d4df42b281fc868ef0ab80e822b.tar.gz
glibc-b8fd550293431d4df42b281fc868ef0ab80e822b.tar.xz
glibc-b8fd550293431d4df42b281fc868ef0ab80e822b.zip
Update.
	* sysdeps/posix/ttyname.c: Make name variable from getttyname function
	global (with file scope).  Add __libc_subfreeres function to free the
	string.
	* sysdeps/unix/sysv/linux/ttyname.c: Likewise.  Also for buf variable
	in ttyname function.

	* sysdeps/generic/strtok.c: Remove initializer for olds variable.

	* crypt/md5-crypt.c: Let destructor deallocate static buffer.

	* iconvdata/sjis.c (from_ucs4_lat1): Handle U005C and U007E by
	mapping them to /x5c and /x7e respectively.
Diffstat (limited to 'crypt')
-rw-r--r--crypt/md5-crypt.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/crypt/md5-crypt.c b/crypt/md5-crypt.c
index e99f8ca199..66eda28d0c 100644
--- a/crypt/md5-crypt.c
+++ b/crypt/md5-crypt.c
@@ -234,14 +234,15 @@ __md5_crypt_r (key, salt, buffer, buflen)
 }
 
 
+static char *buffer;
+
 char *
 __md5_crypt (const char *key, const char *salt)
 {
   /* We don't want to have an arbitrary limit in the size of the
      password.  We can compute the size of the result in advance and
      so we can prepare the buffer we pass to `md5_crypt_r'.  */
-  static char *buffer = NULL;
-  static int buflen = 0;
+  static int buflen;
   int needed = 3 + strlen (salt) + 1 + 26 + 1;
 
   if (buflen < needed)
@@ -253,3 +254,11 @@ __md5_crypt (const char *key, const char *salt)
 
   return __md5_crypt_r (key, salt, buffer, buflen);
 }
+
+
+static void
+__attribute__ ((__constructor__))
+free_mem (void)
+{
+  free (buffer);
+}