Here are some example patches documenting a few leaks we found. Let
me know if these look ok.

These are diff'ed against the Xerces-C-src_1_0_0.zip drop. Looks like
they are still in the latest cvs version of the code at this time. We
were stuffing SAXException's into a stl container, hence the addition
of the constructor/assignment stuff.

Excellent job on the parser - really appreciate it!

diff -c -r orig/framework/XMLAttr.cpp src/framework/XMLAttr.cpp
*** orig/framework/XMLAttr.cpp  Fri Dec 10 17:13:00 1999
--- src/framework/XMLAttr.cpp   Thu Dec 16 01:20:48 1999
***************
*** 217,222 ****
--- 217,223 ----
  void XMLAttr::cleanUp()
  {
      delete [] fName;
+     delete [] fPrefix;
      delete [] fQName;
      delete [] fValue;
  }
diff -c -r orig/internal/ReaderMgr.cpp src/internal/ReaderMgr.cpp
*** orig/internal/ReaderMgr.cpp Fri Dec 10 17:13:04 1999
--- src/internal/ReaderMgr.cpp  Thu Dec 16 01:03:32 1999
***************
*** 682,689 ****
      //
      if (!fReaderStack && !fCurReader)
      {
!         lastInfo.systemId = XMLString::replicate(XMLUni::fgZeroLenString);
!         lastInfo.publicId = XMLString::replicate(XMLUni::fgZeroLenString);
          lastInfo.lineNumber = 0;
          lastInfo.colNumber = 0;
          return;
--- 682,689 ----
      //
      if (!fReaderStack && !fCurReader)
      {
!         lastInfo.systemId = XMLUni::fgZeroLenString;
!         lastInfo.publicId = XMLUni::fgZeroLenString;
          lastInfo.lineNumber = 0;
          lastInfo.colNumber = 0;
          return;
diff -c -r orig/internal/XMLScanner2.cpp src/internal/XMLScanner2.cpp
*** orig/internal/XMLScanner2.cpp       Fri Dec 10 17:13:06 1999
--- src/internal/XMLScanner2.cpp        Thu Dec 16 01:15:09 1999
***************
*** 761,767 ****
          //  Its a valid URL so its assumed to be fully qualified. Get the
          //  base part of the path part of the URL.
          //
!
fReaderMgr.setBasePath(XMLPlatformUtils::getBasePath(tmpURL.getPath()));
      }

      catch(const MalformedURLException&)
--- 761,769 ----
          //  Its a valid URL so its assumed to be fully qualified. Get the
          //  base part of the path part of the URL.
          //
!         XMLCh* pathPtr = XMLPlatformUtils::getBasePath(tmpURL.getPath());
!         ArrayJanitor<XMLCh> janName(pathPtr);
!         fReaderMgr.setBasePath(pathPtr);
      }

      catch(const MalformedURLException&)
***************
*** 770,776 ****
          //  Its not a URL, so assume its just a plain file path and could
          //  be partial, so get the complete path.
          //
!
fReaderMgr.setBasePath(XMLPlatformUtils::getBasePath(src.getSystemId()));
      }
  }

--- 772,780 ----
          //  Its not a URL, so assume its just a plain file path and could
          //  be partial, so get the complete path.
          //
!         XMLCh* pathPtr = XMLPlatformUtils::getBasePath(src.getSystemId());
!         ArrayJanitor<XMLCh> janName(pathPtr);
!         fReaderMgr.setBasePath(pathPtr);
      }
  }

diff -c -r orig/sax/SAXException.hpp src/sax/SAXException.hpp
*** orig/sax/SAXException.hpp   Fri Dec 10 17:13:08 1999
--- src/sax/SAXException.hpp    Thu Dec 16 01:19:41 1999
***************
*** 129,137 ****
--- 129,166 ----
      }


+   /**
+     * Copy constructor.
+     *
+     * @param other The source SAXException  object
+     */
+     SAXException(const SAXException &other) : fMsg(0)
+     {
+         fMsg = XMLString::replicate(other.fMsg);
+     }
+
+
+   /**
+     * Assignment operator
+     *
+     * @param other The source SAXException object
+     */
+     SAXException & operator = (const SAXException &toAssign)
+     {
+         if (this == &toAssign)
+             return *this;
+
+         delete[] fMsg;
+         fMsg = XMLString::replicate(toAssign.fMsg);
+
+         return *this;
+     }
+
+
      /** Destructor */
      virtual ~SAXException()
      {
+         delete[] fMsg;
      }

      //@}

Reply via email to