The lambdas inside get_sstables_from_object_store captured get_abort_src
by reference, but get_abort_src is a by-value function parameter living
on the stack frame of get_sstables_from_object_store. Since the outer
lambda is moved into seastar::async via get_sstables_from and executed
after get_sstables_from_object_store returns, the reference becomes
dangling.
Fix by capturing get_abort_src by value (copying the std::function)
in both lambdas.
Found by AddressSanitizer: stack-use-after-return at
distributed_loader.cc:243.
Fixes SCYLLADB-2172
Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
Closesscylladb/scylladb#29954