minor leak

This commit is contained in:
Hieu Hoang 2014-04-23 11:36:25 +01:00
parent e22b68e2fd
commit 00505ba048
2 changed files with 12 additions and 3 deletions

View File

@ -163,8 +163,14 @@ float ChartTranslationOptionList::GetBestScore(const ChartCellLabel *chartCell)
{ {
const HypoList *stack = chartCell->GetStack().cube; const HypoList *stack = chartCell->GetStack().cube;
assert(stack); assert(stack);
assert(!stack->empty()); //assert(!stack->empty());
const ChartHypothesis &bestHypo = **(stack->begin()); if (stack->empty()) {
return 0;
}
else {
const ChartHypothesis &bestHypo = **(stack->begin());
return bestHypo.GetTotalScore();
} const ChartHypothesis &bestHypo = **(stack->begin());
return bestHypo.GetTotalScore(); return bestHypo.GetTotalScore();
} }

View File

@ -218,7 +218,7 @@ bool RuleTableLoaderStandard::Load(FormatType format
// parse source & find pt node // parse source & find pt node
// constituent labels // constituent labels
Word *sourceLHS; Word *sourceLHS = NULL;
Word *targetLHS; Word *targetLHS;
// create target phrase obj // create target phrase obj
@ -251,6 +251,9 @@ bool RuleTableLoaderStandard::Load(FormatType format
TargetPhraseCollection &phraseColl = GetOrCreateTargetPhraseCollection(ruleTable, sourcePhrase, *targetPhrase, sourceLHS); TargetPhraseCollection &phraseColl = GetOrCreateTargetPhraseCollection(ruleTable, sourcePhrase, *targetPhrase, sourceLHS);
phraseColl.Add(targetPhrase); phraseColl.Add(targetPhrase);
// not implemented correctly in memory pt. just delete it for now
delete sourceLHS;
count++; count++;
} }