You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Denis Linine (JIRA)" <ax...@ws.apache.org> on 2005/08/24 13:13:09 UTC

[jira] Created: (AXISCPP-811) possible memory leak in the int SoapSerializer::setOutputStream( SOAPTransport * pStream) - SoapSerializer.cpp file

possible memory leak in the int SoapSerializer::setOutputStream( SOAPTransport * pStream) - SoapSerializer.cpp file
-------------------------------------------------------------------------------------------------------------------

         Key: AXISCPP-811
         URL: http://issues.apache.org/jira/browse/AXISCPP-811
     Project: Axis-C++
        Type: Bug
  Components: SOAP  
    Reporter: Denis Linine
    Priority: Trivial


Hello,

In the following code from the SoapSerializer.cpp file string * asContentType  leaks.  It should not be heap allocated, I suppose:
string  asContentType = string( "multipart/related; type=\"text/xml\"; start=\"<");
instead of
string * asContentType = new string( "multipart/related; type=\"text/xml\"; start=\"<");
This would also simplify the syntax .
Taken from v 1.5 sources.

PS
Seems to be caused by  too straightforward porting of Java code. 


 if( checkAttachmentAvailability())
 {
	string	asStartID;
	string	asSOAPMimeHeaders;

	asSOAPMimeHeaders = pStream->getIncomingSOAPMimeHeaders();

	int  start  = asSOAPMimeHeaders.find( "Content-Type");
	int startPosIdValue = asSOAPMimeHeaders.find( "<", start + strlen( "Content-Id:")) + 1;
	int endPosIdValue   = asSOAPMimeHeaders.find( ">", start + strlen( "Content-Type"));
	int length          = endPosIdValue - startPosIdValue ;

	asStartID = asSOAPMimeHeaders.substr (startPosIdValue,length); 

	string * asContentType = new string( "multipart/related; type=\"text/xml\"; start=\"<");

	*asContentType = *asContentType + asStartID + ">\"";
	*asContentType = *asContentType + ";  boundary=\"------=MIME BOUNDARY\"";

	pStream->setTransportProperty( CONTENT_TYPE, (*asContentType).c_str()); 

	serialize( "\n------=MIME BOUNDARY\n", NULL);
	serialize( pStream->getIncomingSOAPMimeHeaders(), "\n\n", NULL);
}


-- 
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


[jira] Assigned: (AXISCPP-811) possible memory leak in the int SoapSerializer::setOutputStream( SOAPTransport * pStream) - SoapSerializer.cpp file

Posted by "Samisa Abeysinghe (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXISCPP-811?page=all ]

Samisa Abeysinghe reassigned AXISCPP-811:
-----------------------------------------

    Assign To: Samisa Abeysinghe

> possible memory leak in the int SoapSerializer::setOutputStream( SOAPTransport * pStream) - SoapSerializer.cpp file
> -------------------------------------------------------------------------------------------------------------------
>
>          Key: AXISCPP-811
>          URL: http://issues.apache.org/jira/browse/AXISCPP-811
>      Project: Axis-C++
>         Type: Bug
>   Components: SOAP
>     Reporter: Denis Linine
>     Assignee: Samisa Abeysinghe
>     Priority: Trivial

>
> Hello,
> In the following code from the SoapSerializer.cpp file string * asContentType  leaks.  It should not be heap allocated, I suppose:
> string  asContentType = string( "multipart/related; type=\"text/xml\"; start=\"<");
> instead of
> string * asContentType = new string( "multipart/related; type=\"text/xml\"; start=\"<");
> This would also simplify the syntax .
> Taken from v 1.5 sources.
> PS
> Seems to be caused by  too straightforward porting of Java code. 
>  if( checkAttachmentAvailability())
>  {
> 	string	asStartID;
> 	string	asSOAPMimeHeaders;
> 	asSOAPMimeHeaders = pStream->getIncomingSOAPMimeHeaders();
> 	int  start  = asSOAPMimeHeaders.find( "Content-Type");
> 	int startPosIdValue = asSOAPMimeHeaders.find( "<", start + strlen( "Content-Id:")) + 1;
> 	int endPosIdValue   = asSOAPMimeHeaders.find( ">", start + strlen( "Content-Type"));
> 	int length          = endPosIdValue - startPosIdValue ;
> 	asStartID = asSOAPMimeHeaders.substr (startPosIdValue,length); 
> 	string * asContentType = new string( "multipart/related; type=\"text/xml\"; start=\"<");
> 	*asContentType = *asContentType + asStartID + ">\"";
> 	*asContentType = *asContentType + ";  boundary=\"------=MIME BOUNDARY\"";
> 	pStream->setTransportProperty( CONTENT_TYPE, (*asContentType).c_str()); 
> 	serialize( "\n------=MIME BOUNDARY\n", NULL);
> 	serialize( pStream->getIncomingSOAPMimeHeaders(), "\n\n", NULL);
> }

-- 
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


[jira] Closed: (AXISCPP-811) possible memory leak in the int SoapSerializer::setOutputStream( SOAPTransport * pStream) - SoapSerializer.cpp file

Posted by "Samisa Abeysinghe (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXISCPP-811?page=all ]
     
Samisa Abeysinghe closed AXISCPP-811:
-------------------------------------

    Fix Version: 1.6 Alpha
     Resolution: Fixed

I made it a non pointer local variable.

Thanks Denis for pointing this out

> possible memory leak in the int SoapSerializer::setOutputStream( SOAPTransport * pStream) - SoapSerializer.cpp file
> -------------------------------------------------------------------------------------------------------------------
>
>          Key: AXISCPP-811
>          URL: http://issues.apache.org/jira/browse/AXISCPP-811
>      Project: Axis-C++
>         Type: Bug
>   Components: SOAP
>     Reporter: Denis Linine
>     Assignee: Samisa Abeysinghe
>     Priority: Trivial
>      Fix For: 1.6 Alpha

>
> Hello,
> In the following code from the SoapSerializer.cpp file string * asContentType  leaks.  It should not be heap allocated, I suppose:
> string  asContentType = string( "multipart/related; type=\"text/xml\"; start=\"<");
> instead of
> string * asContentType = new string( "multipart/related; type=\"text/xml\"; start=\"<");
> This would also simplify the syntax .
> Taken from v 1.5 sources.
> PS
> Seems to be caused by  too straightforward porting of Java code. 
>  if( checkAttachmentAvailability())
>  {
> 	string	asStartID;
> 	string	asSOAPMimeHeaders;
> 	asSOAPMimeHeaders = pStream->getIncomingSOAPMimeHeaders();
> 	int  start  = asSOAPMimeHeaders.find( "Content-Type");
> 	int startPosIdValue = asSOAPMimeHeaders.find( "<", start + strlen( "Content-Id:")) + 1;
> 	int endPosIdValue   = asSOAPMimeHeaders.find( ">", start + strlen( "Content-Type"));
> 	int length          = endPosIdValue - startPosIdValue ;
> 	asStartID = asSOAPMimeHeaders.substr (startPosIdValue,length); 
> 	string * asContentType = new string( "multipart/related; type=\"text/xml\"; start=\"<");
> 	*asContentType = *asContentType + asStartID + ">\"";
> 	*asContentType = *asContentType + ";  boundary=\"------=MIME BOUNDARY\"";
> 	pStream->setTransportProperty( CONTENT_TYPE, (*asContentType).c_str()); 
> 	serialize( "\n------=MIME BOUNDARY\n", NULL);
> 	serialize( pStream->getIncomingSOAPMimeHeaders(), "\n\n", NULL);
> }

-- 
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