com php-src: Use zend_string_free instead of efree: ext/standard/password.c
| From: | Nikita Popov | Date: | Fri, 16 Sep 2016 19:30:26 +0000 |
| Subject: | com php-src: Use zend_string_free instead of efree: ext/standard/password.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94573@lists.php.net to get a copy of this message | ||
Commit: 1a94b24ca5b074756c5156d87d454ea6ff0b7bfa
Author: Nikita Popov <nikic@php.net> Fri, 16 Sep 2016 21:28:39 +0200
Parents: dd7affa9ff98e8c84bb8446ed379df9598a8348d
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1a94b24ca5b074756c5156d87d454ea6ff0b7bfa
Log:
Use zend_string_free instead of efree
Fingers crossed I didn't break the build.
Changed paths:
M ext/standard/password.c
Diff:
diff --git a/ext/standard/password.c b/ext/standard/password.c
index 117db2b..d362e6f 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;
}