Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Prevent memory leak.
  • Loading branch information
Mdsujansarkar committed Nov 4, 2025
commit a5aa88874e01732fe25e8c1c7c58ff625385709e
2 changes: 1 addition & 1 deletion ext/random/engine_mt19937.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,11 @@ PHP_METHOD(Random_Engine_Mt19937, __debugInfo)

if (engine->engine.algo->serialize) {
array_init(&t);
zend_hash_str_add(Z_ARR_P(return_value), "__states", strlen("__states"), &t);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you think there is an actual memory leak, please do a separated PR.
It is also better to create a branch from an appropriate origin branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this line.

if (!engine->engine.algo->serialize(engine->engine.state, Z_ARRVAL(t))) {
zend_throw_exception(NULL, "Engine serialize failed", 0);
RETURN_THROWS();
}
zend_hash_str_add(Z_ARR_P(return_value), "__states", strlen("__states"), &t);
}
}
/* }}} */
Loading