SERVER-126463ClosedFixed

Collection cloner with function_ref has memory bug

We have this [piece of code in collection_cloner.cpp|https://github.com/mongodb/mongo/blob/7f59a42e61116840b38a7df540404dad21298ebd/src/mongo/db/repl/initial_sync/collection_cloner.cpp#L565-L569]: This is problematic as described in SERVER-121669, because the temporary that the function_ref is bound to is destroyed right after that line.

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix
9.0.0-rc08.3.168.0.37
Components
Server components related to this issue

No components specified.

Labels
Tags and classification
bkp