diff --git a/db/merge_operator.cc b/db/merge_operator.cc index 43a8df371..d96b165a6 100644 --- a/db/merge_operator.cc +++ b/db/merge_operator.cc @@ -20,8 +20,10 @@ bool MergeOperator::PartialMergeMulti(const Slice& key, Logger* logger) const { // Simply loop through the operands std::string temp_value; - Slice temp_slice; - for (const auto& operand : operand_list) { + Slice temp_slice(operand_list[0]); + + for (int i = 1; i < operand_list.size(); ++i) { + auto& operand = operand_list[i]; if (!PartialMerge(key, temp_slice, operand, &temp_value, logger)) { return false; }