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-12-20 22:06:41 +0400
committerTetsuo Kiso <tetsuo-s@is.naist.jp>2012-12-20 22:06:41 +0400
commitce1b650b53750d13147bace099f3fedf787d6236 (patch)
treeb4459be87b38c0edb49b9375be9c555e8afc2559 /mert/sentence-bleu.cpp
parent139148bc8fd5e77c95157bc82c459a0612e64890 (diff)
Fix memory leak.
The object was allocated with new, but it was not deleted. This may not be a serious problem because the program mostly runs a short time. However, it is not a good practice.
Diffstat (limited to 'mert/sentence-bleu.cpp')
-rw-r--r--mert/sentence-bleu.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/mert/sentence-bleu.cpp b/mert/sentence-bleu.cpp
index 4fd980546..085c81efd 100644
--- a/mert/sentence-bleu.cpp
+++ b/mert/sentence-bleu.cpp
@@ -20,10 +20,10 @@ int main(int argc, char **argv)
string factors;
string filter;
- BleuScorer *scorer = new BleuScorer(config);
- scorer->setFactors(factors);
- scorer->setFilter(filter);
- scorer->setReferenceFiles(refFiles);
+ BleuScorer scorer(config);
+ scorer.setFactors(factors);
+ scorer.setFilter(filter);
+ scorer.setReferenceFiles(refFiles);
vector<ScoreStats> entries;
@@ -31,7 +31,7 @@ int main(int argc, char **argv)
ScoreStats scoreentry;
string line;
while (getline(cin, line)) {
- scorer->prepareStats(entries.size(), line, scoreentry);
+ scorer.prepareStats(entries.size(), line, scoreentry);
entries.push_back(scoreentry);
}
@@ -40,4 +40,5 @@ int main(int argc, char **argv)
vector<float> stats(sentIt->getArray(), sentIt->getArray() + sentIt->size());
cout << BleuScorer::sentenceLevelBleuPlusOne(stats) << "\n";
}
+ return 0;
}