diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-12-29 15:57:15 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-12-29 15:57:15 +0000 |
commit | d1dddedf7893fe70ed5d429485c8bcd0ab43f285 (patch) | |
tree | 99420c13234130854769150b8d81f5fe1d2528e3 /crypt | |
parent | 9403ec5d23e7dc209361b3dbae2fdc184e1684aa (diff) | |
download | glibc-d1dddedf7893fe70ed5d429485c8bcd0ab43f285.zip glibc-d1dddedf7893fe70ed5d429485c8bcd0ab43f285.tar.gz glibc-d1dddedf7893fe70ed5d429485c8bcd0ab43f285.tar.bz2 |
Realloc error handling memory leak fix.
Diffstat (limited to 'crypt')
-rw-r--r-- | crypt/md5-crypt.c | 8 |
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); |