Skip to content

Commit dad1fd0

Browse files
committed
Fix compilation warnings to error, mostly use-after-free and maybe uninitialized.
1 parent 9b9187a commit dad1fd0

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

include/ext_stl/fifo.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ template <class Type> class ElFifo
197197

198198
void incr_capa()
199199
{
200+
if (_capa == 0)
201+
_capa = 1;
202+
200203
Type * NewTab = new Type [2*_capa];
201204
for (INT kk=0; kk<_nb ; kk++)
202205
NewTab[kk] = _tab[(kk+_begin)%_capa];

src/TpMMPD/DeformAnalyse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ int DeformAnalyse_main (int argc, char ** argv)
7676

7777
// 3. get the vector PerResidu
7878
ifstream aPR((aDir + aOut1).c_str());
79-
char *aPerR;
79+
char *aPerR{nullptr};
8080
if(aPR)
8181
{
8282
std::string aLine;

src/TpMMPD/TiePByMesh/TaskCorrel/cAppliTaskCorrel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void cAppliTaskCorrel::ReadXMLMesurePts(string aGCPMesureXML, vector<cImgForTiep
116116
std::list<cOneMesureAF1I> & aMes = iT1->OneMesureAF1I();
117117
string aNameIm = iT1->NameIm();
118118
cout<<endl<<" + Img : "<<aNameIm<<endl;
119-
cImgForTiepTri* aImg;
119+
cImgForTiepTri* aImg{};
120120
for (uint akIm=0; akIm<mVImgs.size(); akIm++)
121121
{
122122
if (aNameIm == mVImgs[akIm]->Name())

src/uti_phgrm/GraphCut/MaxFlow/graph.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ template <typename captype, typename tcaptype, typename flowtype>
5858
flow = 0;
5959
}
6060

61+
/*
6162
template <typename captype, typename tcaptype, typename flowtype>
6263
void Graph<captype,tcaptype,flowtype>::reallocate_nodes(int num)
6364
{
@@ -86,7 +87,9 @@ template <typename captype, typename tcaptype, typename flowtype>
8687
}
8788
}
8889
}
90+
*/
8991

92+
/*
9093
template <typename captype, typename tcaptype, typename flowtype>
9194
void Graph<captype,tcaptype,flowtype>::reallocate_arcs()
9295
{
@@ -117,5 +120,6 @@ template <typename captype, typename tcaptype, typename flowtype>
117120
}
118121
}
119122
}
123+
*/
120124

121125
#include "instances.inc"

src/util/regex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ cElRegex::cElRegex(const std::string & aNameExprIn,int aNbMatchMax,int aCFlag,bo
106106

107107
if (! IsOk())
108108
return;
109-
regmatch_t aMatch;
109+
regmatch_t aMatch{};
110110
mVMatch.reserve(aNbMatchMax);
111111
for (int aK=0; aK<aNbMatchMax ; aK++)
112112
mVMatch.push_back(aMatch);

0 commit comments

Comments
 (0)