Skip to content

Fix RedisCluster XCLAIM and XAUTOCLAIM reply leaks - #2955

Open
ebubekiryigit wants to merge 1 commit into
phpredis:developfrom
ebubekiryigit:fix/cluster-claim-reply-leak
Open

ebubekiryigit wants to merge 1 commit into
phpredis:developfrom
ebubekiryigit:fix/cluster-claim-reply-leak

Conversation

@ebubekiryigit

Copy link
Copy Markdown
Contributor

The cluster claim-reply handler allocates an empty array before calling redis_read_xclaim_reply(). The shared reader initializes the result itself, overwriting the original array and leaking it.

Initialize the result as undefined instead, matching the standalone handler. Command behavior and reply formats are unchanged.

Add memory regression tests for XCLAIM and XAUTOCLAIM, shared by Redis and RedisCluster. They reproduce the leak on develop and pass with the fix. The tests include server-version checks and skip when the Zend memory manager is disabled.

Validation:

  • Redis, RedisArray, RedisCluster and RedisSentinel suites passed on PHP 8.5 / Redis 8.8.
  • Focused Valgrind probes for both commands reported no errors or leaks.

Initialize the result as undefined before the shared XCLAIM/XAUTOCLAIM reader takes ownership. Add retained-allocation regressions for both commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant