Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Fix some Coverity issues (#33988)

Oleg Pipikin257a4bdcf1c4
diff --git a/src/core/src/runtime/tensor.cpp b/src/core/src/runtime/tensor.cpp
index 7df0c7d5694..d2995d0b35c 100644
--- a/src/core/src/runtime/tensor.cpp
+++ b/src/core/src/runtime/tensor.cpp
@@ -222,8 +222,10 @@ Tensor read_tensor_data(const std::filesystem::path& file_name,
bool mmap) {
OPENVINO_ASSERT(element_type != ov::element::string);
if (mmap) {
- auto mapped_memory = ov::load_mmap_object(file_name);
- return read_tensor_data_mmap_impl(mapped_memory, element_type, partial_shape, offset_in_bytes);
+ return read_tensor_data_mmap_impl(ov::load_mmap_object(file_name),
+ element_type,
+ partial_shape,
+ offset_in_bytes);
} else {
auto file_size = std::filesystem::file_size(file_name);
auto static_shape = calc_static_shape_for_file(file_size, element_type, partial_shape, offset_in_bytes);
@@ -238,7 +240,6 @@ Tensor read_tensor_data(ov::FileHandle file_handle,
const ov::PartialShape& partial_shape,
size_t offset_in_bytes) {
OPENVINO_ASSERT(element_type != ov::element::string);
- auto mapped_memory = ov::load_mmap_object(file_handle);
- return read_tensor_data_mmap_impl(mapped_memory, element_type, partial_shape, offset_in_bytes);
+ return read_tensor_data_mmap_impl(ov::load_mmap_object(file_handle), element_type, partial_shape, offset_in_bytes);
}
} // namespace ov