IGXMLScanner allocates from wrong memory manager
------------------------------------------------

         Key: XERCESC-1348
         URL: http://issues.apache.org/jira/browse/XERCESC-1348
     Project: Xerces-C++
        Type: Bug
  Components: Validating Parser (DTD), SAX/SAX2  
    Versions: 2.6.0    
 Environment: Found on solaris, but no a solaris issue.
    Reporter: Mark Weissman


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);

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to