1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-01 10:06:57 +03:00

Realloc error handling memory leak fix.

This commit is contained in:
Ulrich Drepper
2001-12-29 15:57:15 +00:00
parent 9403ec5d23
commit d1dddedf78
10 changed files with 100 additions and 50 deletions

View File

@ -247,9 +247,15 @@ __md5_crypt (const char *key, const char *salt)
if (buflen < needed)
{
char *new_buffer;
buflen = needed;
if ((buffer = realloc (buffer, buflen)) == NULL)
new_buffer = (char *) realloc (buffer, buflen);
if (new_buffer == NULL)
return NULL;
buffer = new_buffer;
}
return __md5_crypt_r (key, salt, buffer, buflen);