memory leak in method ContractNodes

Hello Hal:

There is memory leak in method ContractNodes (below code is from trunk):

26 static void ContractNodes(std::unique_ptr &MatcherPtr,
27 const CodeGenDAGPatterns &CGP) {

43 // transform it.
44 if (MoveChildMatcher *MC = dyn_cast(N)) {
45 Matcher *New = nullptr;
46 if (RecordMatcher *RM = dyn_cast(MC->getNext()))
47 if (MC->getChildNo() < 8) // Only have RecordChild0…7
48 New = new RecordChildMatcher(MC->getChildNo(), RM->getWhatFor(),
49 RM->getResultNo());
50
51 if (CheckTypeMatcher *CT = dyn_cast(MC->getNext()))
52 if (MC->getChildNo() < 8 && // Only have CheckChildType0…7
53 CT->getResNo() == 0) // CheckChildType checks res #0
—> We should delete previous allocated New here!
54 New = new CheckChildTypeMatcher(MC->getChildNo(), CT->getType());
55
56 if (CheckSameMatcher *CS = dyn_cast(MC->getNext()))
57 if (MC->getChildNo() < 4) // Only have CheckChildSame0…3
—> We should delete previous allocated New here!
58 New = new CheckChildSameMatcher(MC->getChildNo(), CS->getMatchNumber());
59
60 if (CheckIntegerMatcher *CS = dyn_cast(MC->getNext()))
61 if (MC->getChildNo() < 5) // Only have CheckChildInteger0…4
—> We should delete previous allocated New here!
62 New = new CheckChildIntegerMatcher(MC->getChildNo(), CS->getValue());
63
64 if (New) {
65 // Insert the new node.
66 New->setNext(MatcherPtr.release());
67 MatcherPtr.reset(New);
68 // Remove the old one.
69 MC->setNext(MC->getNext()->takeNext());
70 return ContractNodes(MatcherPtr, CGP);
71 }

Regards
Hui Wu