axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Kunze (JIRA)" <>
Subject [jira] Created: (AXISCPP-824) Axishandler crashes when releasing Memory
Date Tue, 06 Sep 2005 11:23:32 GMT
Axishandler crashes when releasing Memory

         Key: AXISCPP-824
     Project: Axis-C++
        Type: Bug
  Components: Parser Library - Xerces  
    Versions: 1.5 Final    
 Environment: Visual Studio 6.0, Windows 2000, Axis 1.5 and Xerces 2.6
    Reporter: Marco Kunze
    Priority: Blocker

We developed a Webservice using Axis C++ 1.5. 
We tried out the Axis-Nightbuild 1.6 , Xerces 2.2, 2.6 and 2.7. 
But the effect was the same when Deleting:

delete (const_cast <char*> (cp_PreviousNameOrValue));
delete cp_CurrentNameOrValue;

The Handler crashes and throws an unknown Exception. We were able to isolate the error, but
the fix from 14.6. doesnt work.
Without freeing the Memory the code works fine. But we have to go productive in one Month.
There is about 20 KB of Data in one Element, so the memoryleak sizes to a great amount. We
tried to find an other workaround, but we were not successful yet. You did one fix on that
method, so we hope you can help us. Sample Code and an example Soapmessage can be delivered.

void XercesHandler::characters(const XMLCh* const chars, 
                               const unsigned int length)
    const char* cp_PreviousNameOrValue = NULL;
    if( m_pCurrElement && m_pCurrElement->m_pchNameOrValue)
        if (m_pCurrElement->m_type == CHARACTER_ELEMENT)
            cp_PreviousNameOrValue = m_pCurrElement->m_pchNameOrValue;
    m_pCurrElement = m_pNextElement;
    m_pNextElement->m_type = CHARACTER_ELEMENT;
    if (cp_PreviousNameOrValue)
        char* cp_CurrentNameOrValue = XMLString::transcode(chars);
        //char* cp_FullNameOrValue  = (char*) malloc(strlen(cp_PreviousNameOrValue) + strlen(cp_CurrentNameOrValue)
+ 1);
		//Chinthana:Removed malloc
		char* cp_FullNameOrValue  = new char[strlen(cp_PreviousNameOrValue) + strlen(cp_CurrentNameOrValue)
+ 1];
        cp_FullNameOrValue[0] = '\0'; 
        strcat(cp_FullNameOrValue, cp_PreviousNameOrValue);
        strcat(cp_FullNameOrValue, cp_CurrentNameOrValue);
        m_pNextElement->m_pchNameOrValue = (const char*)cp_FullNameOrValue;
        //free(const_cast <char*> (cp_PreviousNameOrValue));
		//Chinthana:Removed free
		delete (const_cast <char*> (cp_PreviousNameOrValue));
		delete cp_CurrentNameOrValue;

        m_pNextElement->m_pchNameOrValue = XMLString::transcode(chars);

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message