From b8fd550293431d4df42b281fc868ef0ab80e822b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 15 Aug 2000 06:12:25 +0000 Subject: 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. --- crypt/md5-crypt.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'crypt/md5-crypt.c') 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); +} -- cgit v1.2.3