diff options
author | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-03-04 19:35:07 +0400 |
---|---|---|
committer | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-03-04 19:35:07 +0400 |
commit | 5c4e2a8c8d63ffd5dd216e4953168ff54bcdb5ed (patch) | |
tree | e7c08dee7363d6b6b78411b5ad8649d4d762ff32 /mert/mert.cpp | |
parent | c8800f3822497a4f3d7404ea23760de160257b9d (diff) |
Use boost::scoped_ptr to avoid resource leaks.
Diffstat (limited to 'mert/mert.cpp')
-rwxr-xr-x | mert/mert.cpp | 9 |
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; |