mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 05:55:02 +03:00
leak
This commit is contained in:
parent
234ebf2ea5
commit
ca8007be12
@ -83,7 +83,13 @@ PhraseDictionaryNodeSCFG *PhraseDictionaryNodeSCFG::GetOrCreateChild(const Word
|
|||||||
//CHECK(!sourceTerm.IsNonTerminal());
|
//CHECK(!sourceTerm.IsNonTerminal());
|
||||||
|
|
||||||
std::pair <TerminalMap::iterator,bool> insResult;
|
std::pair <TerminalMap::iterator,bool> insResult;
|
||||||
insResult = m_sourceTermMap.insert( std::make_pair(sourceTerm, new PhraseDictionaryNodeSCFG()) );
|
PhraseDictionaryNodeSCFG *node = new PhraseDictionaryNodeSCFG();
|
||||||
|
insResult = m_sourceTermMap.insert( std::make_pair(sourceTerm, node) );
|
||||||
|
|
||||||
|
if (!insResult.second) {
|
||||||
|
delete node;
|
||||||
|
}
|
||||||
|
|
||||||
const TerminalMap::iterator &iter = insResult.first;
|
const TerminalMap::iterator &iter = insResult.first;
|
||||||
PhraseDictionaryNodeSCFG &ret = *iter->second;
|
PhraseDictionaryNodeSCFG &ret = *iter->second;
|
||||||
return &ret;
|
return &ret;
|
||||||
@ -96,7 +102,14 @@ PhraseDictionaryNodeSCFG *PhraseDictionaryNodeSCFG::GetOrCreateChild(const Word
|
|||||||
|
|
||||||
NonTerminalMapKey key(sourceNonTerm, targetNonTerm);
|
NonTerminalMapKey key(sourceNonTerm, targetNonTerm);
|
||||||
std::pair <NonTerminalMap::iterator,bool> insResult;
|
std::pair <NonTerminalMap::iterator,bool> insResult;
|
||||||
insResult = m_nonTermMap.insert( std::make_pair(key, new PhraseDictionaryNodeSCFG()) );
|
PhraseDictionaryNodeSCFG *node = new PhraseDictionaryNodeSCFG();
|
||||||
|
|
||||||
|
insResult = m_nonTermMap.insert( std::make_pair(key, node) );
|
||||||
|
|
||||||
|
if (!insResult.second) {
|
||||||
|
delete node;
|
||||||
|
}
|
||||||
|
|
||||||
const NonTerminalMap::iterator &iter = insResult.first;
|
const NonTerminalMap::iterator &iter = insResult.first;
|
||||||
PhraseDictionaryNodeSCFG &ret = *iter->second;
|
PhraseDictionaryNodeSCFG &ret = *iter->second;
|
||||||
return &ret;
|
return &ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user