Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTetsuo Kiso <tetsuo-s@is.naist.jp>2012-03-04 19:35:07 +0400
committerTetsuo Kiso <tetsuo-s@is.naist.jp>2012-03-04 19:35:07 +0400
commit79b71ed5cd583069f5da333074633644a149d856 (patch)
treee7c08dee7363d6b6b78411b5ad8649d4d762ff32 /mert/mert.cpp
parent2351045f18fbbaabf0c94bce65d70f9ba9bac928 (diff)
Use boost::scoped_ptr to avoid resource leaks.
Diffstat (limited to 'mert/mert.cpp')
-rwxr-xr-xmert/mert.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/mert/mert.cpp b/mert/mert.cpp
index 20940c4bf..694b48e8e 100755
--- a/mert/mert.cpp
+++ b/mert/mert.cpp
@@ -11,6 +11,7 @@
#include <ctime>
#include <getopt.h>
+#include <boost/scoped_ptr.hpp>
#include "Data.h"
#include "Point.h"
@@ -333,17 +334,18 @@ int main(int argc, char **argv)
}
// it make sense to know what parameter set were used to generate the nbest
- Scorer *TheScorer = ScorerFactory::getScorer(option.scorer_type, option.scorer_config);
+ boost::scoped_ptr<Scorer> scorer(
+ ScorerFactory::getScorer(option.scorer_type, option.scorer_config));
//load data
- Data data(*TheScorer);
+ Data data(*scorer);
for (size_t i = 0; i < ScoreDataFiles.size(); i++) {
cerr<<"Loading Data from: "<< ScoreDataFiles.at(i) << " and " << FeatureDataFiles.at(i) << endl;
data.load(FeatureDataFiles.at(i), ScoreDataFiles.at(i));
}
- TheScorer->setScoreData(data.getScoreData().get());
+ scorer->setScoreData(data.getScoreData().get());
//ADDED_BY_TS
data.remove_duplicates();
@@ -506,7 +508,6 @@ int main(int argc, char **argv)
}
}
- delete TheScorer;
PrintUserTime("Stopping...");
return 0;