You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2005/08/27 11:29:02 UTC
cvs commit: ws-axis/c/src/soap/xsd Double.cpp
samisa 2005/08/27 02:29:02
Modified: c/src/soap/xsd Double.cpp
Log:
Fixed the memory leak problems in case of exceptions
Revision Changes Path
1.13 +17 -10 ws-axis/c/src/soap/xsd/Double.cpp
Index: Double.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Double.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Double.cpp 1 Jun 2005 14:22:56 -0000 1.12
+++ Double.cpp 27 Aug 2005 09:29:01 -0000 1.13
@@ -61,14 +61,16 @@
{
AxisString exceptionMessage =
"Value to be serialized is less than MinInclusive specified for this type. MinInclusive = ";
- AxisChar* length = new AxisChar[25];
+ AxisChar length[25];
sprintf(length, "%f", minInclusive->getMinInclusiveAsDouble());
exceptionMessage += length;
exceptionMessage += ", Value = ";
sprintf(length, "%f", *value);
exceptionMessage += length;
exceptionMessage += ".";
- delete [] length;
+
+ if (minInclusive)
+ delete minInclusive;
throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
const_cast<AxisChar*>(exceptionMessage.c_str()));
@@ -83,14 +85,16 @@
{
AxisString exceptionMessage =
"Value to be serialized is less than or equal to MinExclusive specified for this type. MinExclusive = ";
- AxisChar* length = new AxisChar[25];
+ AxisChar length[25];
sprintf(length, "%f", minExclusive->getMinExclusiveAsDouble());
exceptionMessage += length;
exceptionMessage += ", Value = ";
sprintf(length, "%f", *value);
exceptionMessage += length;
exceptionMessage += ".";
- delete [] length;
+
+ if (minExclusive)
+ delete minExclusive;
throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
const_cast<AxisChar*>(exceptionMessage.c_str()));
@@ -106,14 +110,16 @@
{
AxisString exceptionMessage =
"Value to be serialized is greater than MaxInclusive specified for this type. MaxInclusive = ";
- AxisChar* length = new AxisChar[25];
+ AxisChar length[25];
sprintf(length, "%f", maxInclusive->getMaxInclusiveAsDouble());
exceptionMessage += length;
exceptionMessage += ", Value = ";
sprintf(length, "%f", *value);
exceptionMessage += length;
exceptionMessage += ".";
- delete [] length;
+
+ if (maxInclusive)
+ delete maxInclusive;
throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
const_cast<AxisChar*>(exceptionMessage.c_str()));
@@ -128,14 +134,16 @@
{
AxisString exceptionMessage =
"Value to be serialized is greater than or equal to MaxExclusive specified for this type. MaxExclusive = ";
- AxisChar* length = new AxisChar[25];
+ AxisChar length[25];
sprintf(length, "%f", maxExclusive->getMaxExclusiveAsDouble());
exceptionMessage += length;
exceptionMessage += ", Value = ";
sprintf(length, "%f", *value);
exceptionMessage += length;
exceptionMessage += ".";
- delete [] length;
+
+ if (maxExclusive)
+ delete maxExclusive;
throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
const_cast<AxisChar*>(exceptionMessage.c_str()));
@@ -144,11 +152,10 @@
delete maxExclusive;
- AxisChar* serializedValue = new char[80];
+ AxisChar serializedValue[80];
AxisSprintf (serializedValue, 80, "%f", *value);
IAnySimpleType::serialize(serializedValue);
- delete [] serializedValue;
return m_Buf;
}