Fixed memory leaks

This commit is contained in:
Dmitry Stogov 2018-12-13 16:21:08 +03:00
parent db30e0ce16
commit d206630f13
3 changed files with 13 additions and 0 deletions

View File

@ -3782,6 +3782,7 @@ PHP_MSHUTDOWN_FUNCTION(basic) /* {{{ */
#endif
BASIC_MSHUTDOWN_SUBMODULE(crypt)
BASIC_MSHUTDOWN_SUBMODULE(random)
BASIC_MSHUTDOWN_SUBMODULE(password)
zend_hash_destroy(&basic_submodules);
return SUCCESS;

View File

@ -523,6 +523,17 @@ PHP_MINIT_FUNCTION(password) /* {{{ */
}
/* }}} */
PHP_MSHUTDOWN_FUNCTION(password) /* {{{ */
{
#ifdef ZTS
if (!tsrm_is_main_thread()) {
return;
}
#endif
zend_hash_destroy(&php_password_algos);
}
/* }}} */
const php_password_algo* php_password_algo_default() {
return &php_password_algo_bcrypt;
}

View File

@ -27,6 +27,7 @@ PHP_FUNCTION(password_get_info);
PHP_FUNCTION(password_algos);
PHP_MINIT_FUNCTION(password);
PHP_MSHUTDOWN_FUNCTION(password);
#define PHP_PASSWORD_DEFAULT PHP_PASSWORD_BCRYPT
#define PHP_PASSWORD_BCRYPT_COST 10