Skip to content

Commit d206630

Browse files
committed
Fixed memory leaks
1 parent db30e0c commit d206630

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

ext/standard/basic_functions.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3782,6 +3782,7 @@ PHP_MSHUTDOWN_FUNCTION(basic) /* {{{ */
37823782
#endif
37833783
BASIC_MSHUTDOWN_SUBMODULE(crypt)
37843784
BASIC_MSHUTDOWN_SUBMODULE(random)
3785+
BASIC_MSHUTDOWN_SUBMODULE(password)
37853786

37863787
zend_hash_destroy(&basic_submodules);
37873788
return SUCCESS;

ext/standard/password.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,17 @@ PHP_MINIT_FUNCTION(password) /* {{{ */
523523
}
524524
/* }}} */
525525

526+
PHP_MSHUTDOWN_FUNCTION(password) /* {{{ */
527+
{
528+
#ifdef ZTS
529+
if (!tsrm_is_main_thread()) {
530+
return;
531+
}
532+
#endif
533+
zend_hash_destroy(&php_password_algos);
534+
}
535+
/* }}} */
536+
526537
const php_password_algo* php_password_algo_default() {
527538
return &php_password_algo_bcrypt;
528539
}

ext/standard/php_password.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ PHP_FUNCTION(password_get_info);
2727
PHP_FUNCTION(password_algos);
2828

2929
PHP_MINIT_FUNCTION(password);
30+
PHP_MSHUTDOWN_FUNCTION(password);
3031

3132
#define PHP_PASSWORD_DEFAULT PHP_PASSWORD_BCRYPT
3233
#define PHP_PASSWORD_BCRYPT_COST 10

0 commit comments

Comments
 (0)