From: Павел Фаттахов/AI Tools Lab /SRR/Assistant Engineer/삼성전자
Date: Tue, 20 Nov 2018 18:10:31 +0000 (+0300)
Subject: [nnc] fix static analysis warning and add missed break (#2287)
X-Git-Tag: nncc_backup~1298
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ec37f1e1e18ee9667788934e6bdbd8aff3140f2f;p=platform%2Fcore%2Fml%2Fnnfw.git
[nnc] fix static analysis warning and add missed break (#2287)
- Add assert, which protects us from passing a null pointer to a function.
- Add break statement into switch in tflite_importer.
Signed-off-by: Pavel
---
diff --git a/contrib/nnc/passes/tflite_frontend/tflite_importer.cpp b/contrib/nnc/passes/tflite_frontend/tflite_importer.cpp
index 318658a..d96fe5a 100644
--- a/contrib/nnc/passes/tflite_frontend/tflite_importer.cpp
+++ b/contrib/nnc/passes/tflite_frontend/tflite_importer.cpp
@@ -188,6 +188,7 @@ void TfliteImporter::walkOperator(const Operator* op) {
break;
case BuiltinOperator_SQUEEZE:
outputs = _opCreator->createSqueeze(inputs, params, op->builtin_options_as());
+ break;
case BuiltinOperator_ADD:
outputs = _opCreator->createAdd(inputs, params, op->builtin_options_as());
break;
@@ -264,6 +265,7 @@ std::vector> TfliteImporter::createOpParams(const Oper
std::shared_ptr TfliteImporter::createTensor(const Tensor* t, const Buffer* b) {
// Create TensorVariant by copying the tensor buffer contents.
// Another option is to copy the data in a TensorVariant constructor.
+ assert(b->data() != nullptr);
std::shared_ptr tensor_buffer_copy(new char[b->data()->size()],
[](char* d) { delete[] d; });
std::copy(b->data()->begin(), b->data()->end(), tensor_buffer_copy.get());