Fix svace: deref nullptr (#6925)
author이춘석/On-Device Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Tue, 27 Aug 2019 01:29:10 +0000 (10:29 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 27 Aug 2019 01:29:10 +0000 (10:29 +0900)
- Fix WGID 405891
- fix by using polymorphic_downcast instead of dynamic_cast

Signed-off-by: Chunseok Lee <chunseok.lee@samsung.com>
runtimes/neurun/core/src/exec/ExecutionObservers.cc

index d80d612..e6561fe 100644 (file)
@@ -18,6 +18,7 @@
 #include "util/logging.h"
 #include "model/operation/PermuteNode.h"
 #include "exec/IExecutor.h"
+#include "misc/polymorphic_downcast.h"
 
 namespace neurun
 {
@@ -58,7 +59,8 @@ void ProfileObserver::handleEnd(IExecutor *exec, const model::Operation *node,
   }
   if (node_name == "Permute")
   {
-    auto *permute_node = dynamic_cast<const model::operation::PermuteNode *>(node);
+    auto *permute_node =
+        nnfw::misc::polymorphic_downcast<const model::operation::PermuteNode *>(node);
     assert(permute_node != nullptr);
     _et->updatePermuteTime(permute_node->param().input_backend_ctx->backend,
                            permute_node->param().output_backend_ctx->backend, is_quantized, size,