From: abn Date: Thu, 21 Dec 2023 09:11:24 +0000 (+0100) Subject: [OverlapDEC] valgrind on uninitialized array of bool X-Git-Tag: V9_13_0a1~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a586fa46acf8c7bd262adbd273de33d45caf2b03;p=tools%2Fmedcoupling.git [OverlapDEC] valgrind on uninitialized array of bool --- diff --git a/src/ParaMEDMEM/OverlapMapping.cxx b/src/ParaMEDMEM/OverlapMapping.cxx index 203dd3ff3..b19d1706e 100644 --- a/src/ParaMEDMEM/OverlapMapping.cxx +++ b/src/ParaMEDMEM/OverlapMapping.cxx @@ -619,7 +619,9 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl INTERP_KERNEL::AutoPtr tmp=new double[nbOfCompo]; // By default field value set to default value - so mark which cells are hit - INTERP_KERNEL::AutoPtr hit_cells = new bool[fieldOutput->getNumberOfTuples()]; + mcIdType ntup = fieldOutput->getNumberOfTuples(); + INTERP_KERNEL::AutoPtr hit_cells = new bool[ntup]; + std::fill((bool *)hit_cells, (bool *)hit_cells+ntup, false); for(vector::const_iterator itProc=_the_matrix_st_source_proc_id.begin(); itProc != _the_matrix_st_source_proc_id.end();itProc++) // For each source processor corresponding to a locally held matrix: @@ -750,7 +752,7 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl // Fill in default values for cells which haven't been hit: int i = 0; - for(bool * hit_cells_ptr=hit_cells; i< fieldOutput->getNumberOfTuples(); hit_cells_ptr++,i++) + for(bool * hit_cells_ptr=hit_cells; i< ntup; hit_cells_ptr++,i++) if (!(*hit_cells_ptr)) { double * targetPt=fieldOutput->getArray()->getPointer();