Conversation
| return REDISMODULE_OK; | ||
| } | ||
| if (*tgt) { | ||
| rm_free(*tgt); |
There was a problem hiding this comment.
Not needed, and also not the correct free function
There was a problem hiding this comment.
Bug: Incomplete Cleanup Path Leaks Memory
When ninfo.node->range is NULL, the code jumps to loop_cleanup without calling resetCardinality, which transfers ownership of ninfo.cardValsArr. This leaves ninfo.cardValsArr allocated but not freed in the cleanup section, causing a memory leak. The cleanup at loop_cleanup needs to free ninfo.cardValsArr when status == FGC_COLLECTED.
src/fork_gc.c#L963-L967
Lines 963 to 967 in fc0c19e
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.10 #7315 +/- ##
==========================================
- Coverage 89.28% 89.25% -0.04%
==========================================
Files 207 207
Lines 35309 35307 -2
==========================================
- Hits 31525 31512 -13
- Misses 3784 3795 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fix leak (cherry picked from commit 81036bb)
|
Successfully created backport PR for |
Fix memory menegment in
recvNumIdxandrecvCardvalsMark if applicable
Note
Fixes memory leaks in fork GC by correctly freeing cardinality arrays on error and simplifying recvCardvals allocation/zero-length handling.
recvCardvals:*tgt; allocate witharray_newlenand read directly; early-return on zero length.recvNumIdx:idxbufsandcardValsArr, then zeroninfoto avoid leaks/invalid state.ninfois expected zeroed.Written by Cursor Bugbot for commit fc0c19e. This will update automatically on new commits. Configure here.