Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1348

IGXMLScanner allocates from wrong memory manager

    XMLWordPrintableJSON

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

      Attachments

        1. patch.txt
          7 kB
          David N Bertoni

        Activity

          People

            dbertoni David N Bertoni
            weissman Mark Weissman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: