mirror of
https://github.com/php/php-src.git
synced 2026-10-28 17:56:50 +08:00
random: Fix memory leak when serialization fails (#20383)
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
This commit is contained in:
1 parent
bf599d4059
commit
720e006982
1 file changed
+1
-1
@@ -329,11 +329,11 @@ PHP_METHOD(Random_Engine_Mt19937, __serialize)
|
||||
|
||||
/* state */
|
||||
array_init(&t);
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &t);
|
||||
if (!engine->algo->serialize(engine->status, Z_ARRVAL(t))) {
|
||||
zend_throw_exception(NULL, "Engine serialize failed", 0);
|
||||
RETURN_THROWS();
|
||||
}
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &t);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
Reference in new issue
Block a user