Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.6.0
-
None
-
None
-
Found on solaris, but no a solaris issue.
Description
IGXMLScanner.c allocates from fGrammarPoolMemoryManager instead of fMemoryManager.
This causes a memory leak and thread safety issues when sharing
an unsynchronized grammar pool across multiple threads. I included diffs
that affect my application but I suspect this problem exists for other
scanners too. It would be good if somebody could check all uses of
fGrammarPoolMemoryManager to verify the immutability of cached grammars
and thread safety for the GrammarPool. When not parsing grammars, the
pool should not change.
> diff IGXMLScanner.cpp IGXMLScanner.cpp.orig
1256,1257c1256
< MemoryManager rootDeclMgr = /*MDW/fUseCachedGrammar ? fMemoryManager : fGrammarPoolMemoryManager;
< DTDElementDecl* rootDecl = new (/MDW/rootDeclMgr) DTDElementDecl
—
> DTDElementDecl* rootDecl = new (fGrammarPoolMemoryManager) DTDElementDecl
1262c1261
< , /MDW/rootDeclMgr
—
> , fGrammarPoolMemoryManager
1497c1496
< DTDEntityDecl* declDTD = new (fMemoryManager/MDW/) DTDEntityDecl(gDTDStr, false, fMemoryManager/MDW/);
—
> DTDEntityDecl* declDTD = new (fGrammarPoolMemoryManager) DTDEntityDecl(gDTDStr, false, fGrammarPoolMemoryManager);