diff options
author | Sascha Schumann <sas@php.net> | 2000-11-22 21:52:53 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 2000-11-22 21:52:53 +0000 |
commit | 53e3452649030b1c228823c7a290e13f61262508 (patch) | |
tree | b76bc20cce9e3431bc391274deddaca9bc2fe3fd /ext/mhash | |
parent | e937eeb2e5eb1a133e96485b8fdd6b8e0eac80a7 (diff) | |
download | php-git-53e3452649030b1c228823c7a290e13f61262508.tar.gz |
Avoid estrdup and a couple of other minor cleanups
Diffstat (limited to 'ext/mhash')
-rw-r--r-- | ext/mhash/mhash.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/ext/mhash/mhash.c b/ext/mhash/mhash.c index 4e65718f08..58abc9fa2e 100644 --- a/ext/mhash/mhash.c +++ b/ext/mhash/mhash.c @@ -164,12 +164,10 @@ PHP_FUNCTION(mhash) php_error(E_WARNING, MHASH_FAILED_MSG); RETURN_FALSE; } - td = - mhash_hmac_init(Z_LVAL_PP(hash), + td = mhash_hmac_init(Z_LVAL_PP(hash), Z_STRVAL_PP(key), Z_STRLEN_PP(key), - mhash_get_hash_pblock((*hash)->value. - lval)); + mhash_get_hash_pblock(Z_LVAL_PP(hash))); } else { td = mhash_init(Z_LVAL_PP(hash)); } @@ -249,19 +247,18 @@ PHP_FUNCTION(mhash_keygen_s2k) keystruct.salt = salt; keystruct.salt_size = salt_len; - ret = malloc(size); + ret = emalloc(size); if (ret==NULL) { php_error(E_WARNING, MHASH_KEYGEN_FAILED_MSG); RETURN_FALSE; } val = mhash_keygen_ext( KEYGEN_S2K_SALTED, keystruct, ret, size, password, password_len); - if ( val >= 0) { - RETVAL_STRINGL(ret, size, 1); - free(ret); + if (val >= 0) { + RETVAL_STRINGL(ret, size, 0); } else { php_error(E_WARNING, MHASH_KEYGEN_FAILED_MSG); - free(ret); + efree(ret); RETURN_FALSE; } } |