]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
avoid use-after-move error
authorAndrew Kryczka <ajkr@users.noreply.github.com>
Tue, 29 Aug 2017 18:57:59 +0000 (11:57 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 29 Aug 2017 19:11:56 +0000 (12:11 -0700)
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

db/range_del_aggregator.cc

index 0aa5d22cbcb119b5297dbedeacb480eaa98a034d..cb51ea7f876075e70792e7712c8e48e1f65e5ce8 100644 (file)
@@ -357,7 +357,8 @@ Status RangeDelAggregator::AddTombstone(RangeTombstone tombstone) {
       ++new_range_dels_iter;
     }
   } 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();
 }