From 9f0a498e7ecb2769d5262a19b53dbab4083f9252 Mon Sep 17 00:00:00 2001
From: scott snyder <snyder@bnl.gov>
Date: Tue, 16 Oct 2018 18:08:51 +0200
Subject: [PATCH] CaloRec: Fix coverity 118976, 118910, 118918.

Coverity warnings: uninitialized member; potential null pointer dereference.


Former-commit-id: 2f55b9c2a2451b1e201bba53a47af9207ddf8d23
---
 .../CaloRec/src/CaloCellContainerFinalizerTool.cxx        | 3 ++-
 .../CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx   | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Calorimeter/CaloRec/src/CaloCellContainerFinalizerTool.cxx b/Calorimeter/CaloRec/src/CaloCellContainerFinalizerTool.cxx
index b9352ef88b9..22c33e88490 100644
--- a/Calorimeter/CaloRec/src/CaloCellContainerFinalizerTool.cxx
+++ b/Calorimeter/CaloRec/src/CaloCellContainerFinalizerTool.cxx
@@ -38,7 +38,8 @@ CaloCellContainerFinalizerTool::CaloCellContainerFinalizerTool(
 			     const std::string& type, 
 			     const std::string& name, 
 			     const IInterface* parent)
-  :AthAlgTool(type, name, parent) 
+  :AthAlgTool(type, name, parent),
+   m_theCaloCCIDM(nullptr)
 {
   declareInterface<ICaloCellMakerTool>(this); 
   declareInterface<ICaloConstCellMakerTool>(this); 
diff --git a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx
index 1d3312a7ac0..c390034bdb6 100755
--- a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx
+++ b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx
@@ -459,7 +459,7 @@ CaloClusterMomentsMaker_DigiHSTruth::execute(const EventContext& /*ctx*/,
 	  }
 	}
 	else {
-	  if ( myCDDE && ! (myCDDE->is_tile()) 
+	  if ( ! (myCDDE->is_tile()) 
 	       && ((pCell->provenance() & 0x2000) == 0x2000) 
 	       && !((pCell->provenance() & 0x0800) == 0x0800)) {
 	    if ( pCell->quality() > m_minBadLArQuality ) {
@@ -468,7 +468,7 @@ CaloClusterMomentsMaker_DigiHSTruth::execute(const EventContext& /*ctx*/,
 	    eLAr2  += ene*weight*ene*weight;
 	    eLAr2Q += ene*weight*ene*weight*pCell->quality();
 	  }
-	  if ( myCDDE && myCDDE->is_tile() ) {
+	  if ( myCDDE->is_tile() ) {
 	    uint16_t tq = pCell->quality();
 	    uint8_t tq1 = (0xFF00&tq)>>8; // quality in channel 1
 	    uint8_t tq2 = (0xFF&tq); // quality in channel 2
@@ -513,7 +513,7 @@ CaloClusterMomentsMaker_DigiHSTruth::execute(const EventContext& /*ctx*/,
 	  double Sig = (sigma>0?ene*weight/sigma:0);
 	  if ( fabs(Sig) > fabs(maxAbsSig) ) {
 	    maxAbsSig = Sig;
-	    nSigSampl = myCDDE->getSampling();
+            nSigSampl = myCDDE->getSampling();
 	  }
 	}
 	if ( m_calculateIsolation ) {
@@ -541,7 +541,7 @@ CaloClusterMomentsMaker_DigiHSTruth::execute(const EventContext& /*ctx*/,
 	  }
 	}
 
-	if ( myCDDE && ene > 0. && weight > 0) {
+	if ( ene > 0. && weight > 0) {
 	  // get all geometric information needed ...
           CaloClusterMomentsMaker_detail::cellinfo& ci = cellinfo[ncell];
 	  ci.x      = myCDDE->x();
-- 
GitLab