aboutsummaryrefslogtreecommitdiff
path: root/crypt/md5-crypt.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-12-29 15:57:15 +0000
committerUlrich Drepper <drepper@redhat.com>2001-12-29 15:57:15 +0000
commitd1dddedf7893fe70ed5d429485c8bcd0ab43f285 (patch)
tree99420c13234130854769150b8d81f5fe1d2528e3 /crypt/md5-crypt.c
parent9403ec5d23e7dc209361b3dbae2fdc184e1684aa (diff)
downloadglibc-d1dddedf7893fe70ed5d429485c8bcd0ab43f285.zip
glibc-d1dddedf7893fe70ed5d429485c8bcd0ab43f285.tar.gz
glibc-d1dddedf7893fe70ed5d429485c8bcd0ab43f285.tar.bz2
Realloc error handling memory leak fix.
Diffstat (limited to 'crypt/md5-crypt.c')
-rw-r--r--crypt/md5-crypt.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/crypt/md5-crypt.c b/crypt/md5-crypt.c
index 018b2df..0f7f3ec 100644
--- a/crypt/md5-crypt.c
+++ b/crypt/md5-crypt.c
@@ -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);