Skip to content

Fix/valgrind leaks#76

Open
gabsow wants to merge 3 commits intomasterfrom
fix/valgrind-leaks
Open

Fix/valgrind leaks#76
gabsow wants to merge 3 commits intomasterfrom
fix/valgrind-leaks

Conversation

@gabsow
Copy link
Contributor

@gabsow gabsow commented Jan 19, 2026

Note

Addresses memory-safety issues in cluster communication.

  • On shard connect failures, explicitly redisAsyncFree(c) when c->err is set to avoid leaking the async context
  • In MR_ClusterInnerCommunicationMsg, switch from RedisModule_HoldString() to RedisModule_CreateStringFromString() when copying argv for event-loop processing, preventing unsafe references to client query buffers

Written by Cursor Bugbot for commit 1dccca2. This will update automatically on new commits. Configure here.

Deep-copy argv in MR_ClusterInnerCommunicationMsg before handing to the event-loop thread, and lock the module GIL while parsing and dispatching the message to avoid use-after-free when Redis trims the client query buffer.
Keep argv deep-copy but drop ThreadSafeContextLock/Unlock wrapping in MR_ClusterInnerCommunicationMsgRun for testing whether deep-copy alone resolves the ASan UAF.
Free hiredis async context when redisAsyncConnect returns an error state, instead of leaking it (improves valgrind results under cluster send/reconnect scenarios).
@gabsow gabsow force-pushed the fix/valgrind-leaks branch from 7f82a6c to 1dccca2 Compare January 19, 2026 10:31
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