From cc3ef523d56f83476208c107a2a2db9fa02babc9 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Fri, 5 Jun 2015 15:26:22 -0400 Subject: [PATCH] sstables: do not write stack variables This code is blatantly wrong, because it writes stack variables to the underlying storage. After this patch, the code is no longer wrong. Right is better than wrong, so we should apply this. Signed-off-by: Glauber Costa Reviewed-by: Pekka Enberg --- sstables/sstables.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sstables/sstables.cc b/sstables/sstables.cc index bdaa8ed41d..111f6d4113 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -418,9 +418,7 @@ future<> parse(random_access_reader& in, disk_hash& h) { template future<> write(file_writer& out, std::unordered_map& map) { return do_for_each(map.begin(), map.end(), [&out, &map] (auto& val) { - Key key = val.first; - Value value = val.second; - return write(out, key, value); + return write(out, val.first, val.second); }); }