Commits

don't leak Records allocated by toRecord in agentflagger, CAS-12489
No tags

gcwrap/tools/flagging/agentflagger_cmpt.cc

Modified
116 116 const std::string& correlation,
117 117 const std::string& intent,
118 118 const std::string& observation)
119 119 {
120 120
121 121 try {
122 122
123 123 if (agentflagger_p) {
124 124
125 125 if (! selconfig.empty()) {
126 - Record config = *toRecord(selconfig);
127 - // Select based on the record
128 - return agentflagger_p->selectData(config);
126 + std::unique_ptr<Record> config(toRecord(selconfig));
127 + // Select based on the record
128 + return agentflagger_p->selectData(*config);
129 129 }
130 130 else {
131 131
132 132 // Select based on the parameters
133 133 return agentflagger_p->selectData(
134 134 String(field),String(spw),String(array),
135 135 String(feed),String(scan),String(antenna),
136 136 String(uvrange),String(timerange),String(correlation),
137 137 String(intent), String(observation));
138 138 }
145 145 }
146 146 }
147 147
148 148
149 149 bool
150 150 agentflagger::parseagentparameters(const ::casac::record& aparams)
151 151 {
152 152 try
153 153 {
154 154
155 - Record agent_params = *toRecord(aparams);
155 + std::unique_ptr<Record> agent_params(toRecord(aparams));
156 156
157 - if(agentflagger_p){
158 - return agentflagger_p->parseAgentParameters(agent_params);
159 - }
157 + if(agentflagger_p){
158 + return agentflagger_p->parseAgentParameters(*agent_params);
159 + }
160 160
161 - return false;
161 + return false;
162 162 } catch(AipsError x) {
163 - *logger_p << LogIO::SEVERE << "Exception Reported: " << x.getMesg() << LogIO::POST;
164 - RETHROW(x);
163 + *logger_p << LogIO::SEVERE << "Exception Reported: " << x.getMesg() << LogIO::POST;
164 + RETHROW(x);
165 165 }
166 166 }
167 167
168 168 bool
169 169 agentflagger::init()
170 170 {
171 171 try
172 172 {
173 173 if(agentflagger_p){
174 174 return agentflagger_p->initAgents();

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

Add shortcut