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 <glommer@cloudius-systems.com>
Reviewed-by: Pekka Enberg <penberg@cloudius-systems.com>
This commit is contained in:
Glauber Costa
2015-06-05 15:26:22 -04:00
committed by Avi Kivity
parent 8a6f362ef8
commit cc3ef523d5

View File

@@ -418,9 +418,7 @@ future<> parse(random_access_reader& in, disk_hash<Size, Key, Value>& h) {
template <typename Key, typename Value>
future<> write(file_writer& out, std::unordered_map<Key, Value>& 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);
});
}