Axis-C++
  1. Axis-C++
  2. AXISCPP-1055

Memory Leak in SoapSerializer::addOutputParam()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: current (nightly)
    • Component/s: Serialization
    • Labels:
      None
    • Environment:
      Windows XP, VS6 with Compuware BoundsChecker

      Description

      The function:
      int SoapSerializer::addOutputParam( const AxisChar * pchName, void * pValue, XSDTYPE type)

      contains a memory leak. xsdValue is not being deleted. Here is our proposed change:
      /*

      • Basic output parameter going to be serialized as an Element later
        */
        int SoapSerializer::
        addOutputParam( const AxisChar * pchName, void * pValue, XSDTYPE type)
        {
        IAnySimpleType* xsdValue = AxisUtils::createSimpleTypeObject(pValue, type);

      Param * pParam = new Param();

      if( !pParam)
      return AXIS_FAIL;

      pParam->m_Type = type;
      pParam->m_sName = pchName;

      pParam->setValue(type, xsdValue);

      if( m_pSoapEnvelope &&
      (m_pSoapEnvelope->m_pSoapBody) &&
      (m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod))
      m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->addOutputParam( pParam);
      else

      { delete xsdValue; delete pParam; return AXIS_FAIL; }

      delete xsdValue;
      return AXIS_SUCCESS; // Can it only be successful?
      }

        Activity

        Hide
        nadir amra added a comment -

        xsdValue is passed to Param object using:

        pParam->setValue(type, xsdValue);

        The xsdValue is then owned by the Param object, which deletes the object when Param destructor is invoked.

        Show
        nadir amra added a comment - xsdValue is passed to Param object using: pParam->setValue(type, xsdValue); The xsdValue is then owned by the Param object, which deletes the object when Param destructor is invoked.

          People

          • Assignee:
            Unassigned
            Reporter:
            Ryan McCullough
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development