Skip to content

Commit e7ae014

Browse files
committed
[Coverity] Fix coverity issues
This PR resolves coverity issues of use of auto that causes a copy and missing lock. **Self-evaluation:** 1. Build test: [X]Passed [ ]Failed [ ]Skipped 2. Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: Donghyeon Jeong <dhyeon.jeong@samsung.com>
1 parent 7e7934e commit e7ae014

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

api/capi/src/nntrainer.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ int ml_train_model_destroy(ml_train_model_h model) {
412412
ML_TRAIN_RESET_VALIDATED_HANDLE(x.second);
413413
delete (x.second);
414414
}
415-
nnmodel->layers_map.clear();
416415

417416
delete nnmodel;
418417

@@ -785,12 +784,12 @@ int ml_train_optimizer_destroy(ml_train_optimizer_h optimizer) {
785784
{
786785
ML_TRAIN_GET_VALID_OPT_LOCKED_RESET(nnopt, optimizer);
787786
ML_TRAIN_ADOPT_LOCK(nnopt, optimizer_lock);
788-
}
789787

790-
if (nnopt->in_use) {
791-
ml_loge("Cannot delete optimizer already set to a model."
792-
"Delete model will delete this optimizer.");
793-
return ML_ERROR_INVALID_PARAMETER;
788+
if (nnopt->in_use) {
789+
ml_loge("Cannot delete optimizer already set to a model."
790+
"Delete model will delete this optimizer.");
791+
return ML_ERROR_INVALID_PARAMETER;
792+
}
794793
}
795794

796795
if (nnopt->lr_scheduler) {

nntrainer/utils/node_exporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ void Exporter::saveTflResult(const std::tuple<props::TargetShape> &props,
287287
createIfNull(tf_node);
288288

289289
tf_node->setOpType(tflite::BuiltinOperator_RESHAPE);
290-
auto targetShape = std::get<props::TargetShape>(props).get();
290+
const auto &targetShape = std::get<props::TargetShape>(props).get();
291291
std::vector<int32_t> new_shape_vec = {
292292
static_cast<int32_t>(targetShape.batch()),
293293
static_cast<int32_t>(targetShape.height()),

0 commit comments

Comments
 (0)