From 9e2782d92376c03298d442ab85142e81cc91833b Mon Sep 17 00:00:00 2001 From: Daniel Patterson Date: Mon, 14 Nov 2016 18:00:29 -0800 Subject: [PATCH] Fix undefined behaviour - we were referring to two different temporaries. --- src/storage/storage.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/storage/storage.cpp b/src/storage/storage.cpp index ca921a242..04877d455 100644 --- a/src/storage/storage.cpp +++ b/src/storage/storage.cpp @@ -485,10 +485,10 @@ void Storage::LoadData(DataLayout *layout_ptr, char *memory_ptr) std::fill(file_index_path_ptr, file_index_path_ptr + layout_ptr->GetBlockSize(DataLayout::FILE_INDEX_PATH), 0); - auto absolute_file_index_path = boost::filesystem::absolute(config.file_index_path); - std::copy(absolute_file_index_path.string().begin(), - absolute_file_index_path.string().end(), - file_index_path_ptr); + const auto absolute_file_index_path = + boost::filesystem::absolute(config.file_index_path).string(); + std::copy( + absolute_file_index_path.begin(), absolute_file_index_path.end(), file_index_path_ptr); } // Name data