From: Nikita Popov Date: Fri, 16 Sep 2016 19:28:39 +0000 (+0200) Subject: Use zend_string_free instead of efree X-Git-Tag: php-7.2.0alpha1~1247 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a94b24ca5b074756c5156d87d454ea6ff0b7bfa;p=php Use zend_string_free instead of efree Fingers crossed I didn't break the build. --- diff --git a/ext/standard/password.c b/ext/standard/password.c index 117db2bf16..d362e6f7f3 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -529,6 +529,8 @@ PHP_FUNCTION(password_hash) size_t out_len = 32; size_t encoded_len; int status = 0; + char *out; + zend_string *encoded; encoded_len = argon2_encodedlen( time_cost, @@ -538,8 +540,8 @@ PHP_FUNCTION(password_hash) out_len ); - zend_string *out = zend_string_alloc(out_len, 0); - zend_string *encoded = zend_string_alloc(encoded_len, 0); + out = emalloc(out_len + 1); + encoded = zend_string_alloc(encoded_len, 0); status = argon2_hash( time_cost, @@ -549,9 +551,9 @@ PHP_FUNCTION(password_hash) password_len, salt, salt_len, - out->val, + out, out_len, - encoded->val, + ZSTR_VAL(encoded), encoded_len, type, ARGON2_VERSION_NUMBER @@ -561,7 +563,7 @@ PHP_FUNCTION(password_hash) efree(salt); if (status != ARGON2_OK) { - efree(encoded); + zend_string_free(encoded); php_error_docref(NULL, E_WARNING, argon2_error_message(status)); RETURN_FALSE; }