TXMLEngine memory leaks

Hello, the TXMLEngine class has many methods returning pointers, as:

XMLDocPointer_t	ParseFile(const char* filename, Int_t maxbuf = 100000)

who has the responsility to delete this return values?

from the code (root.cern.ch/root/html/src/TXMLE … x.html#983) it seems that there is no ownership from the class. Can you clarify? this is the valgrind output:

==14732== 48 bytes in 2 blocks are definitely lost in loss record 26,210 of 37,763
==14732==    at 0x4A0695E: operator new(unsigned long) (vg_replace_malloc.c:220)
==14732==    by 0x7436322: TXMLEngine::NewDoc(char const*) (in /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/5.34.07-x86_64-slc5-gcc4.3/lib/libXMLIO.so)
==14732==    by 0x7439C93: TXMLEngine::ParseStream(TXMLInputStream*) (in /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/5.34.07-x86_64-slc5-gcc4.3/lib/libXMLIO.so)
==14732==    by 0x743A20B: TXMLEngine::ParseFile(char const*, int) (in /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/5.34.07-x86_64-slc5-gcc4.3/lib/libXMLIO.so)
==14732==    by 0x4C4768A: egammaMVACalibNew::parse_xml(TString) (egammaMVACalibNew.cxx:1011)
==14732==    by 0x4C4794F: egammaMVACalibNew::setupReader(TMVA::Reader*, TString) (egammaMVACalibNew.cxx:453)
==14732==    by 0x4C496F2: egammaMVACalibNew::getReaders(TString) (egammaMVACalibNew.cxx:326)
==14732==    by 0x4C4A52A: egammaMVACalibNew::egammaMVACalibNew(int, TString, TString, int, bool, TString, TString, TString, TString, bool) (egammaMVACalibNew.cxx:116)
==14732==    by 0x400EDB: main (test_new.cxx:11)

I have tried to delete XMLDocPointer_t, but it is a void*. Why do you need to use void*?

Hmm, I’ve opened the documentation link you mentioned in your first message and immediately found FreeDocument member-function, isn’t it exactly what you need?
One reason why you want to return some “opaque” pointer is to hide implementation details.