diff --git a/src/util/regx/RegularExpression.cpp b/src/util/regx/RegularExpression.cpp index 184b2b0c863d637e79d6b0d496b857f19b5afc2f..193073da710a4cff830c26b4ba07bacebb4ffc45 100644 --- a/src/util/regx/RegularExpression.cpp +++ b/src/util/regx/RegularExpression.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2001/10/09 12:20:25 tng + * Leak fix: Need to delete fMatch if adopted. + * * Revision 1.4 2001/05/11 21:50:58 knoaman * Schema updates and fixes. * @@ -155,6 +158,8 @@ void RegularExpression::Context::reset(const XMLCh* const string fLimit = limit; fLength = fLimit - fStart; fInUse = true; + if (fAdoptMatch) + delete fMatch; fMatch = 0; if (fOffsets == 0 || fSize != noClosures) { @@ -439,6 +444,8 @@ bool RegularExpression::matches(const XMLCh* const expression, const int start, adoptMatch = true; } + if (context->fAdoptMatch) + delete context->fMatch; context->fMatch = lMatch; context->fAdoptMatch = adoptMatch; @@ -1302,3 +1309,4 @@ unsigned short RegularExpression::getCharType(const XMLCh ch) { /** * End of file RegularExpression.cpp */ + diff --git a/src/util/regx/RegularExpression.hpp b/src/util/regx/RegularExpression.hpp index a211fe83e5d41eec7fb30e10539785e93d10dbd9..2c95311cdaa9337c9c6617aeaca183dd0c5022b4 100644 --- a/src/util/regx/RegularExpression.hpp +++ b/src/util/regx/RegularExpression.hpp @@ -112,11 +112,6 @@ public: static const unsigned short WT_LETTER; static const unsigned short WT_OTHER; - // ----------------------------------------------------------------------- - // Setter methods - // ----------------------------------------------------------------------- - void setPattern(const XMLCh* const pattern, const XMLCh* const options=0); - // ----------------------------------------------------------------------- // Public Helper methods // ----------------------------------------------------------------------- @@ -178,6 +173,11 @@ private: // ----------------------------------------------------------------------- void cleanUp(); + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setPattern(const XMLCh* const pattern, const XMLCh* const options=0); + // ----------------------------------------------------------------------- // Private Helper methods // -----------------------------------------------------------------------