mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
random: Fix memory leak when serialization fails (#20383)
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
This commit is contained in:
@@ -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