diff --git a/src/dist/block_service/local/local_service.cpp b/src/dist/block_service/local/local_service.cpp index 40e4a7a795..dbaec6dd28 100644 --- a/src/dist/block_service/local/local_service.cpp +++ b/src/dist/block_service/local/local_service.cpp @@ -413,7 +413,7 @@ dsn::task_ptr local_file_object::read(const read_request &req, dinfo("read file(%s), size = %ld", file_name().c_str(), total_sz); std::string buf; - buf.reserve(total_sz + 1); + buf.resize(total_sz + 1); std::ifstream fin(file_name(), std::ifstream::in); if (!fin.is_open()) { resp.err = ERR_FS_INTERNAL;