Skip to content

Commit 736c5dc

Browse files
committed
Fixed memory leak (ext/hash/tests/mhash_001.phpt failure)
1 parent 9883fec commit 736c5dc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ext/hash/hash.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ PHP_FUNCTION(mhash)
12021202
if (algorithm >= 0 && algorithm < MHASH_NUM_ALGOS) {
12031203
struct mhash_bc_entry algorithm_lookup = mhash_to_hash[algorithm];
12041204
if (algorithm_lookup.hash_name) {
1205-
algo = zend_string_init(algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name), 1);
1205+
algo = zend_string_init(algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name), 0);
12061206
}
12071207
}
12081208

@@ -1211,6 +1211,10 @@ PHP_FUNCTION(mhash)
12111211
} else {
12121212
php_hash_do_hash(return_value, algo, data, data_len, 1, 0);
12131213
}
1214+
1215+
if (algo) {
1216+
zend_string_release(algo);
1217+
}
12141218
}
12151219
/* }}} */
12161220

0 commit comments

Comments
 (0)