[ coverity ] Fix coverity issue
authorskykongkong8 <ss.kong@samsung.com>
Wed, 5 Feb 2025 04:19:30 +0000 (13:19 +0900)
committerjijoong.moon <jijoong.moon@samsung.com>
Tue, 11 Feb 2025 05:43:25 +0000 (14:43 +0900)
- Fixes:
leaked_storage: Variable handle going out of scope leaks the storage it points to.
- Apply:
Use std::move(factory_func) instead of factory_func.

**Self evaluation:**
1. Build test:     [X]Passed [ ]Failed [ ]Skipped
2. Run test:     [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: skykongkong8 <ss.kong@samsung.com>
nntrainer/app_context.cpp

index 09b6fd10f4bbf1c9714a97edc00ba57d0d61a01e..cd398f0d116a4b157dbebfff353b3a4832af7ae3 100644 (file)
@@ -499,7 +499,7 @@ int AppContext::registerLayer(const std::string &library_path,
       return layer;
     };
 
-  return registerFactory<nntrainer::Layer>(factory_func, type);
+  return registerFactory<nntrainer::Layer>(std::move(factory_func), type);
 }
 
 int AppContext::registerOptimizer(const std::string &library_path,
@@ -538,7 +538,7 @@ int AppContext::registerOptimizer(const std::string &library_path,
       return optimizer;
     };
 
-  return registerFactory<nntrainer::Optimizer>(factory_func, type);
+  return registerFactory<nntrainer::Optimizer>(std::move(factory_func), type);
 }
 
 std::vector<int>