-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Sharding
-
Fully Compatible
-
ALL
-
65
Memory for a batch is allocated here using 'new', and is only deallocated when _cancelBatches is called.
In the code path added in a recent commit, there's a new early return which does not call _cancelBatches, compared to the adjacent branch below, which does.
_cancelBatches does need to be called in both places, and adding it to the new branch would fix the memory leak.
However, I don't see any reason we should be using raw pointers with memory allocated using 'new' here. We should probably either change this to use smart pointers or stack allocated memory so that we don't have to worry about introducing memory leaks accidentally in the future.