]> granicus.if.org Git - php/commitdiff
Fixed memory leaks
authorDmitry Stogov <dmitry@zend.com>
Thu, 13 Dec 2018 13:21:08 +0000 (16:21 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 13 Dec 2018 13:21:08 +0000 (16:21 +0300)
ext/standard/basic_functions.c
ext/standard/password.c
ext/standard/php_password.h

index f3905832a06284fe4cd9d72075c0414c3b76d8a6..68aa7e1ef3de7c03e4a6fccc462228ee6ec297a2 100644 (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;
index 36c14b8ef24c20ab731b1df62ab5c227f297ecb4..1fa70e0e262f519c7d32ab2d0095d098cf3f3cf4 100644 (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;
 }
index 4d9d6b46f1887a8f4590383904da0f3f404e4681..a1acd91cfcf000269405e7c4dee02ec6db0ff775 100644 (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