From: Dmitry Stogov Date: Wed, 19 Aug 2020 06:30:08 +0000 (+0300) Subject: Fixed memory leak (ext/hash/tests/mhash_001.phpt failure) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=736c5dca100813da4a32dab78f524b8b2f9c92e4;p=php Fixed memory leak (ext/hash/tests/mhash_001.phpt failure) --- diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 3f01ebcce6..64be043362 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -1202,7 +1202,7 @@ PHP_FUNCTION(mhash) if (algorithm >= 0 && algorithm < MHASH_NUM_ALGOS) { struct mhash_bc_entry algorithm_lookup = mhash_to_hash[algorithm]; if (algorithm_lookup.hash_name) { - algo = zend_string_init(algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name), 1); + algo = zend_string_init(algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name), 0); } } @@ -1211,6 +1211,10 @@ PHP_FUNCTION(mhash) } else { php_hash_do_hash(return_value, algo, data, data_len, 1, 0); } + + if (algo) { + zend_string_release(algo); + } } /* }}} */