From d772e21e19fd45d3b7b63f6bb74ec5d777b587e1 Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@cnes.fr>
Date: Mon, 2 May 2016 17:20:31 +0200
Subject: [PATCH] COMP: Fixing coverity issue 1350187 (uninitialized class
 members) and moving constructor and destructor bodies to cxx file

---
 .../include/otbPolygonClassStatisticsAccumulator.h       | 5 +++--
 .../src/otbPolygonClassStatisticsAccumulator.cxx         | 9 +++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Modules/Learning/Sampling/include/otbPolygonClassStatisticsAccumulator.h b/Modules/Learning/Sampling/include/otbPolygonClassStatisticsAccumulator.h
index 4807effe5c..0a1e1c2d50 100644
--- a/Modules/Learning/Sampling/include/otbPolygonClassStatisticsAccumulator.h
+++ b/Modules/Learning/Sampling/include/otbPolygonClassStatisticsAccumulator.h
@@ -62,9 +62,10 @@ public:
 
 protected:
   /** Constructor */
-  PolygonClassStatisticsAccumulator() {}
+  PolygonClassStatisticsAccumulator();
+    
   /** Destructor */
-  virtual ~PolygonClassStatisticsAccumulator() {}
+  virtual ~PolygonClassStatisticsAccumulator();
 
 private:
   //Number of pixels in all the polygons
diff --git a/Modules/Learning/Sampling/src/otbPolygonClassStatisticsAccumulator.cxx b/Modules/Learning/Sampling/src/otbPolygonClassStatisticsAccumulator.cxx
index 28002be97a..0652e9b3a9 100644
--- a/Modules/Learning/Sampling/src/otbPolygonClassStatisticsAccumulator.cxx
+++ b/Modules/Learning/Sampling/src/otbPolygonClassStatisticsAccumulator.cxx
@@ -21,6 +21,15 @@
 namespace otb
 {
 
+PolygonClassStatisticsAccumulator::PolygonClassStatisticsAccumulator() :
+  m_NbPixelsGlobal(0UL),
+  m_ElmtsInClass(),
+  m_Polygon()
+{}
+  
+PolygonClassStatisticsAccumulator::~PolygonClassStatisticsAccumulator()
+{}
+
 void
 PolygonClassStatisticsAccumulator
 ::Reset()
-- 
GitLab