[ 
http://issues.apache.org/jira/browse/AXISCPP-808?page=comments#action_12320246 
] 

Samisa Abeysinghe commented on AXISCPP-808:
-------------------------------------------

If I remember correct, the rationale to have the pointers as return values was 
something related to nillable values. Hence it is not safe to remove this.

Other fixes can be made.

> possible memory leak in the AxisChar* Double::serialize(const xsd__double* 
> value) function
> ------------------------------------------------------------------------------------------
>
>          Key: AXISCPP-808
>          URL: http://issues.apache.org/jira/browse/AXISCPP-808
>      Project: Axis-C++
>         Type: Bug
>   Components: XSD Types
>     Versions: current (nightly)
>     Reporter: Denis Linine
>     Priority: Trivial

>
> Hi
> Here is  the code from the Double.cpp file.
> AxisChar* Double::serialize(const xsd__double* value) throw 
> (AxisSoapException)
> {
>     MinInclusive* minInclusive = getMinInclusive();
>     if (minInclusive->isSet())
>     {
>         if ( *value < minInclusive->getMinInclusiveAsDouble() )
>         {
>             AxisString exceptionMessage =
>             "Value to be serialized is less than MinInclusive specified for 
> this type.  MinInclusive = ";
>             AxisChar* length = new AxisChar[25];
>             sprintf(length, "%f", minInclusive->getMinInclusiveAsDouble());
>             exceptionMessage += length;
>             exceptionMessage += ", Value = ";
>             sprintf(length, "%f", *value);
>             exceptionMessage += length;
>             exceptionMessage += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minInclusive;
>     MinExclusive* minExclusive = getMinExclusive();
>     if (minExclusive->isSet())
>     {
>         if ( *value <= minExclusive->getMinExclusiveAsDouble() )
>         {
>             AxisString exceptionMessage =
>             "Value to be serialized is less than or equal to MinExclusive 
> specified for this type.  MinExclusive = ";
>             AxisChar* length = new AxisChar[25];
>             sprintf(length, "%f", minExclusive->getMinExclusiveAsDouble());
>             exceptionMessage += length;
>             exceptionMessage += ", Value = ";
>             sprintf(length, "%f", *value);
>             exceptionMessage += length;
>             exceptionMessage += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minExclusive;
>  
>     MaxInclusive* maxInclusive = getMaxInclusive();
>     if (maxInclusive->isSet())
>     {
>         if ( *value > maxInclusive->getMaxInclusiveAsDouble() )
>         {
>             AxisString exceptionMessage =
>             "Value to be serialized is greater than MaxInclusive specified 
> for this type.  MaxInclusive = ";
>             AxisChar* length = new AxisChar[25];
>             sprintf(length, "%f", maxInclusive->getMaxInclusiveAsDouble());
>             exceptionMessage += length;
>             exceptionMessage += ", Value = ";
>             sprintf(length, "%f", *value);
>             exceptionMessage += length;
>             exceptionMessage += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxInclusive;
>     MaxExclusive* maxExclusive = getMaxExclusive();
>     if (maxExclusive->isSet())
>     {
>         if ( *value >= maxExclusive->getMaxExclusiveAsDouble() )
>         {
>             AxisString exceptionMessage =
>             "Value to be serialized is greater than or equal to MaxExclusive 
> specified for this type.  MaxExclusive = ";
>             AxisChar* length = new AxisChar[25];
>             sprintf(length, "%f", maxExclusive->getMaxExclusiveAsDouble());
>             exceptionMessage += length;
>             exceptionMessage += ", Value = ";
>             sprintf(length, "%f", *value);
>             exceptionMessage += length;
>             exceptionMessage += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxExclusive;
>  
>     AxisChar* serializedValue = new char[80];
>     AxisSprintf (serializedValue, 80, "%f", *value);
>       
>       IAnySimpleType::serialize(serializedValue);
>     delete [] serializedValue;        
>     return m_Buf;
> }
> it seems that the memory used by  minInclusive,  minExclusive , etc will not 
> be freed if an exception is thrown.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to