From 5fef34fd3a42b31abb0e454d467e0128b115a69c Mon Sep 17 00:00:00 2001 From: anand76 Date: Wed, 26 Oct 2022 22:34:36 -0700 Subject: [PATCH] Fix a potential std::vector use after move bug (#10845) Summary: The call to `folly::coro::collectAllRange()` should move the input `mget_tasks`. But just in case, assert and clear the std::vector before reusing. Pull Request resolved: https://github.com/facebook/rocksdb/pull/10845 Reviewed By: akankshamahajan15 Differential Revision: D40611719 Pulled By: anand1976 fbshipit-source-id: 0f32b387cf5a2894b13389016c020b01ab479b5e --- db/version_set.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/db/version_set.cc b/db/version_set.cc index 284fa1ca9..7a4ca3431 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -2833,6 +2833,7 @@ Status Version::MultiGetAsync( std::vector statuses = folly::coro::blockingWait( folly::coro::collectAllRange(std::move(mget_tasks)) .scheduleOn(&range->context()->executor())); + mget_tasks.clear(); for (Status stat : statuses) { if (!stat.ok()) { s = stat;