From 7e019af50d42199d1a1f0b6901b6305bcb96e55f Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 3 Sep 2020 18:01:38 +0000 Subject: [PATCH] checks and fixes from static code analyzers results (2) --- modules/calib3d/src/usac.hpp | 4 +++- modules/dnn/src/dnn.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/calib3d/src/usac.hpp b/modules/calib3d/src/usac.hpp index 4fcf58762f..f658e87d38 100644 --- a/modules/calib3d/src/usac.hpp +++ b/modules/calib3d/src/usac.hpp @@ -405,7 +405,9 @@ struct SPRT_history { double epsilon, delta, A; // number of samples processed by test int tested_samples; // k - SPRT_history () { + SPRT_history () + : epsilon(0), delta(0), A(0) + { tested_samples = 0; } }; diff --git a/modules/dnn/src/dnn.cpp b/modules/dnn/src/dnn.cpp index 797120ac47..5bf7694320 100644 --- a/modules/dnn/src/dnn.cpp +++ b/modules/dnn/src/dnn.cpp @@ -2731,6 +2731,7 @@ struct Net::Impl : public detail::NetImplBase bool fuse_eltwise = false, fuse_activation = false; if (IS_DNN_OPENCL_TARGET(preferableTarget) && !nextFusabeleActivLayer.empty() && + nextData && (!nextData->type.compare("ReLU") || !nextData->type.compare("ChannelsPReLU") || !nextData->type.compare("Power")) && @@ -2753,7 +2754,7 @@ struct Net::Impl : public detail::NetImplBase if (currLayer->tryFuse(layer)) { fuse_eltwise = true; /* eltwise was successfully fused */ - if (!nextFusabeleActivLayer.empty()) + if (!nextFusabeleActivLayer.empty() && nextData) { if ((!nextData->type.compare("ReLU") || !nextData->type.compare("ReLU6") || @@ -2774,6 +2775,7 @@ struct Net::Impl : public detail::NetImplBase CV_Assert(!fuse_activation || fuse_eltwise); /* cannot fuse activation without eltwise */ if(fuse_eltwise && fuse_activation) { + CV_Assert(nextData); CV_Assert_N(biasLayerData->outputBlobsWrappers.size() == 1, ld.inputBlobsWrappers.size() == 1); ld.inputBlobsWrappers.push_back(biasLayerData->outputBlobsWrappers[0]); printf_(("\tfused with %s\n", nextEltwiseLayer->name.c_str()));