Commits

fix leaks by replacing raw pointers with local vars, CAS-12410
No tags

code/flagging/Flagging/FlagCalTableHandler.cc

Modified
67 67 // -----------------------------------------------------------------------
68 68 // Open CalTable
69 69 // -----------------------------------------------------------------------
70 70 bool
71 71 FlagCalTableHandler::open()
72 72 {
73 73 if (originalCalTable_p) delete originalCalTable_p;
74 74 originalCalTable_p = new NewCalTable(tablename_p,Table::Update,Table::Plain);
75 75
76 76 // Read field names
77 - ROMSFieldColumns *fieldSubTable = new ROMSFieldColumns(originalCalTable_p->field());
78 - fieldNames_p = new Vector<String>(fieldSubTable->name().getColumn());
77 + ROMSFieldColumns fieldSubTable(originalCalTable_p->field());
78 + fieldNames_p = new Vector<String>(fieldSubTable.name().getColumn());
79 79 *logger_p << LogIO::DEBUG1 << "Field names are " << *fieldNames_p << LogIO::POST;
80 80
81 81 // Read antenna names and diameters from Antenna table
82 - ROMSAntennaColumns *antennaSubTable = new ROMSAntennaColumns(originalCalTable_p->antenna());
83 - antennaNames_p = new Vector<String>(antennaSubTable->name().getColumn());
84 - antennaDiameters_p = new Vector<Double>(antennaSubTable->dishDiameter().getColumn());
85 - antennaPositions_p = new ROScalarMeasColumn<MPosition>(antennaSubTable->positionMeas());
82 + ROMSAntennaColumns antennaSubTable(originalCalTable_p->antenna());
83 + antennaNames_p = new Vector<String>(antennaSubTable.name().getColumn());
84 + antennaDiameters_p = new Vector<Double>(antennaSubTable.dishDiameter().getColumn());
85 + antennaPositions_p = new ROScalarMeasColumn<MPosition>(antennaSubTable.positionMeas());
86 86 *logger_p << LogIO::DEBUG1 << "There are " << antennaNames_p->size() << " antennas with names: " << *antennaNames_p << LogIO::POST;
87 87
88 88 // File the baseline to Ant1xAnt2 map
89 89 String baseline;
90 90 std::pair<Int,Int> ant1ant2;
91 91 for (Int ant1Idx=0;ant1Idx < static_cast<Int>(antennaNames_p->size());ant1Idx++)
92 92 {
93 93 for (Int ant2Idx=ant1Idx+1;ant2Idx < static_cast<Int>(antennaNames_p->size());ant2Idx++)
94 94 {
95 95 ant1ant2.first = ant1Idx;

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut