Memory leak for nillable types
------------------------------

         Key: AXISCPP-625
         URL: http://issues.apache.org/jira/browse/AXISCPP-625
     Project: Axis-C++
        Type: Bug
  Components: Deserialization  
    Versions: 1.5 Final    
 Environment: Linux RHEL3
    Reporter: Carsten Blecken
    Priority: Minor


In SoapDeSerializer.cpp there are five places where a xsd__boolean is allocated 
into a local
variable. Since the variable goes out of scope the memory needs to get deleted.

On line 1206:
                            xsd__boolean * isNill = 
getAttributeAsBoolean("nil", 0);\
                            if (NULL != isNill && true_ == *isNill)\
                            {\
                                ((cpp_type*)Array.m_Array)[nIndex] = NULL;\
                                m_pNode = m_pParser->next();\
                                m_pNode = NULL;\
                                continue;\
                            }\

Proposed replacement:

                            xsd__boolean * isNill = 
getAttributeAsBoolean("nil", 0);\
                            if (NULL != isNill) {\
                                if (true_ == *isNill) {\
                                    ((cpp_type*)Array.m_Array)[nIndex] = NULL;\
                                    m_pNode = m_pParser->next();\
                                    m_pNode = NULL;\
                                    delete isNill;
                                    continue;\
                                } else {\
                                    delete isNill;
                                }\
                            }\

On line 1686,1831,3503,3617:

            xsd__boolean * isNill = getAttributeAsBoolean("nil", 0);
            if (NULL != isNill)
            {
                if(true_ == *isNill)
                        {
                            m_pParser->next ();
                            m_pNode = NULL;
                            return NULL;
                        }
            }

Proposed replacement:

            xsd__boolean * isNill = getAttributeAsBoolean("nil", 0);
            if (NULL != isNill)
            {
                if(true_ == *isNill)
                        {
                            m_pParser->next ();
                            m_pNode = NULL;
                            delete isNill;
                            return NULL;
                        } else {
                            delete isNill;
                        }
            }



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