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>
This commit is contained in:
Glauber Costa
2015-06-05 14:50:50 -04:00
parent 90a82eeb85
commit 5503e140d5

View File

@@ -419,9 +419,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);
});
}