From ea26b6c8443d526a93db413ca3a7637605114909 Mon Sep 17 00:00:00 2001 From: Parichay Kapoor Date: Tue, 9 Feb 2021 12:11:59 +0900 Subject: [PATCH] [manager] svace issue fix Uninitialized class member issue fixed for manager.cpp - MMapedMemory Added class member initialization **Self evaluation:** 1. Build test: [x]Passed [ ]Failed [ ]Skipped 2. Run test: [x]Passed [ ]Failed [ ]Skipped Signed-off-by: Parichay Kapoor --- nntrainer/tensor/manager.cpp | 5 +++-- nntrainer/tensor/manager.h | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/nntrainer/tensor/manager.cpp b/nntrainer/tensor/manager.cpp index cf8f335..b618719 100644 --- a/nntrainer/tensor/manager.cpp +++ b/nntrainer/tensor/manager.cpp @@ -35,10 +35,11 @@ #include namespace nntrainer { -MMapedMemory::MMapedMemory(size_t size, bool allocate_fd) : +MMapedMemory::MMapedMemory(size_t size, bool allocate_fd_) : fd(-1), buf(nullptr), - buf_size(0) { + buf_size(0), + allocate_fd(allocate_fd_) { #ifndef __ANDROID__ if (allocate_fd) { diff --git a/nntrainer/tensor/manager.h b/nntrainer/tensor/manager.h index d56bbc0..fb08f46 100644 --- a/nntrainer/tensor/manager.h +++ b/nntrainer/tensor/manager.h @@ -36,9 +36,9 @@ public: * @brief Construct a new MMapedMemory object * * @param size bytesize of the memory chunk - * @param allocate_fd map a shared memory object to a file + * @param allocate_fd_ map a shared memory object to a file */ - MMapedMemory(size_t size, bool allocate_fd = false); + MMapedMemory(size_t size, bool allocate_fd_ = false); ~MMapedMemory() noexcept; @@ -70,10 +70,10 @@ public: void *data() noexcept { return typedBuffer(); } private: - bool allocate_fd; /**< option to choose to allocate an fd */ int fd; /**< fd to access the shared_memory */ void *buf; /**< buffer object when use_shared_memory */ size_t buf_size; /**< buffer size */ + bool allocate_fd; /**< option to choose to allocate an fd */ }; /** -- 2.7.4