For the first the IXMLDOMNodePtr and IXMLDOMNamedNodeMapPtr etc. are smart pointers. they must not been AddRef'ed and not Release'd. If you call the AddRef you MUST call a Release to the same interface pointer! In your code are two AddRef calls and no Release. Thats the reason the parameter pNode is never Released.
On the position:
m_pCurNode = pNode;
I don't know what type
m_pCurNode
is but I assume its a smart pointer too. so you have only to remove the two
pNode->AddRef();
expressions from your code.
regards.