dbertoni 00/05/29 15:22:55
Modified: c/src/PlatformSupport XalanNumberFormat.cpp
Log:
Added array_auto_ptr to protect dynamic allocation.
Revision Changes Path
1.3 +7 -5 xml-xalan/c/src/PlatformSupport/XalanNumberFormat.cpp
Index: XalanNumberFormat.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanNumberFormat.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XalanNumberFormat.cpp 2000/05/15 15:51:19 1.2
+++ XalanNumberFormat.cpp 2000/05/29 22:22:55 1.3
@@ -55,7 +55,11 @@
* <http://www.apache.org/>.
*/
#include "XalanNumberFormat.hpp"
+
+
+
#include "DOMStringHelper.hpp"
+#include "STLHelper.hpp"
@@ -126,6 +130,8 @@
XalanDOMChar* const buffer = new XalanDOMChar[bufsize];
+ array_auto_ptr<XalanDOMChar> theGuard(buffer);
+
XalanDOMChar* p = buffer + bufsize - 1;
*p-- = 0; // null terminate
@@ -143,12 +149,8 @@
*p-- = c;
}
-
- XalanDOMString s(++p);
-
- delete [] buffer;
- return s;
+ return XalanDOMString(++p);
}