dbertoni    00/08/03 08:27:46

  Modified:    c/src/XSLT Stylesheet.cpp StylesheetHandler.cpp
  Log:
  Fixed leaks.
  
  Revision  Changes    Path
  1.27      +6 -1      xml-xalan/c/src/XSLT/Stylesheet.cpp
  
  Index: Stylesheet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.cpp,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Stylesheet.cpp    2000/07/25 14:52:12     1.26
  +++ Stylesheet.cpp    2000/08/03 15:27:44     1.27
  @@ -169,10 +169,15 @@
        using std::for_each;
   #endif
   
  -     // Clean up all entries in the vector.
  +     // Clean up all entries in the imports vector.
        for_each(m_imports.begin(),
                         m_imports.end(),
                         DeleteFunctor<Stylesheet>());
  +
  +     // Clean up all entries in the include vector.
  +     for_each(m_includeStack.begin(),
  +                      m_includeStack.end(),
  +                      DeleteFunctor<XMLURL>());
   
        // Clean up the atribute sets vector
        for_each(m_attributeSets.begin(),
  
  
  
  1.36      +16 -2     xml-xalan/c/src/XSLT/StylesheetHandler.cpp
  
  Index: StylesheetHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.cpp,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- StylesheetHandler.cpp     2000/07/13 22:22:41     1.35
  +++ StylesheetHandler.cpp     2000/08/03 15:27:45     1.36
  @@ -1149,7 +1149,7 @@
                        URLAutoPtrType  hrefUrl = 
m_constructionContext.getURLFromString(href, includeStack.back()->getURLText());
                        assert(hrefUrl.get() != 0);
   
  -                     Stylesheet::URLStackType& importStack = 
m_stylesheet.getStylesheetRoot().getImportStack();
  +                     Stylesheet::URLStackType&       importStack = 
m_stylesheet.getStylesheetRoot().getImportStack();
   
                        if(stackContains(importStack, *hrefUrl.get()))
                        {
  @@ -1160,6 +1160,9 @@
   
                        importStack.push_back(hrefUrl.get());
   
  +                     // We have to release this right now, since the 
stylesheet
  +                     // will delete it during its destructor.  However, once 
we
  +                     // pop it off the stack, we'll need to delete it.
                        const XMLURL* const             hrefUrlptr = 
hrefUrl.release();
   
                        const XalanDOMString    
theImportURI(hrefUrlptr->getURLText());
  @@ -1182,8 +1185,12 @@
                        // release the auto_ptr.
                        importedStylesheet.release();
   
  +                     assert(importStack.back() == hrefUrlptr);
                        importStack.pop_back();
  -                     
  +
  +                     // The stylesheet is now done with it, so delete it...
  +                     delete hrefUrlptr;
  +
                        m_stylesheet.setXSLTNamespaceURI(saved_XSLNameSpaceURL);
                }
                else if(!isAttrOK(aname, atts, i))
  @@ -1235,11 +1242,18 @@
   
                        m_stylesheet.getIncludeStack().push_back(hrefUrl.get());
   
  +                     // We have to release this right now, since the 
stylesheet
  +                     // will delete it during its destructor.  However, once 
we
  +                     // pop it off the stack, we'll need to delete it.
                        const XMLURL* const             hrefUrlptr = 
hrefUrl.release();
   
                        m_constructionContext.parseXML(*hrefUrlptr, this, 
&m_stylesheet);
   
  +                     assert(m_stylesheet.getIncludeStack().back() == 
hrefUrlptr);
                        m_stylesheet.getIncludeStack().pop_back();
  +
  +                     // The stylesheet is now done with it, so delete it...
  +                     delete hrefUrlptr;
                }
                else if(!isAttrOK(aname, atts, i))
                {
  
  
  

Reply via email to