提交 b7679723 编写于 作者: A Andrew Kryczka 提交者: Facebook Github Bot

avoid use-after-move error

Summary:
* db/range_del_aggregator.cc (AddTombstone): Avoid a potential
use-after-move bug. The original code would both use and move
`tombstone` in a context where the order of those operations is
not specified.  The fix is to perform the use on a new, preceding
statement.

Author: meyering
Closes https://github.com/facebook/rocksdb/pull/2796

Differential Revision: D5721163

Pulled By: ajkr

fbshipit-source-id: a1d328d6a77a17c6425e8069860a202e615e2f48
上级 c4174427
...@@ -357,7 +357,8 @@ Status RangeDelAggregator::AddTombstone(RangeTombstone tombstone) { ...@@ -357,7 +357,8 @@ Status RangeDelAggregator::AddTombstone(RangeTombstone tombstone) {
++new_range_dels_iter; ++new_range_dels_iter;
} }
} else { } else {
tombstone_map.emplace(tombstone.start_key_, std::move(tombstone)); auto start_key = tombstone.start_key_;
tombstone_map.emplace(start_key, std::move(tombstone));
} }
return Status::OK(); return Status::OK();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册