dbertoni 01/02/16 11:50:23
Modified: c/src/XSLT XSLTEngineImpl.cpp
Log:
Guard against memory leak when an exception is thrown.
Revision Changes Path
1.89 +12 -0 xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
Index: XSLTEngineImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- XSLTEngineImpl.cpp 2001/02/13 16:49:12 1.88
+++ XSLTEngineImpl.cpp 2001/02/16 19:50:22 1.89
@@ -785,6 +785,8 @@
{
pushTime(frag);
+ XalanAutoPtr<Stylesheet> theGuard;
+
if(isRoot)
{
StylesheetRoot* const theLocalRoot =
@@ -801,6 +803,8 @@
#else
stylesheet =
constructionContext.create(*const_cast<StylesheetRoot*>(m_stylesheetRoot),
stringHolder);
#endif
+
+ theGuard.reset(stylesheet);
}
StylesheetHandler stylesheetProcessor(*stylesheet,
constructionContext);
@@ -815,6 +819,8 @@
frag);
stylesheet->postConstruction();
+
+ theGuard.release();
}
else
{
@@ -831,6 +837,8 @@
XALAN_STATIC_UCODE_STRING(" =========="));
pushTime(&localXSLURLString);
+ XalanAutoPtr<Stylesheet> theGuard;
+
if(isRoot)
{
StylesheetRoot* const theLocalRoot =
@@ -847,6 +855,8 @@
#else
stylesheet = new
Stylesheet(*const_cast<StylesheetRoot*>(m_stylesheetRoot), localXSLURLString,
constructionContext);
#endif
+
+ theGuard.reset(stylesheet);
}
StylesheetHandler stylesheetProcessor(*stylesheet,
constructionContext);
@@ -860,6 +870,8 @@
m_parserLiaison.parseXMLStream(inputSource,
stylesheetProcessor);
stylesheet->postConstruction();
+
+ theGuard.release();
displayDuration("Parsing and init of " + localXSLURLString,
&localXSLURLString);
}