Uploaded image for project: 'Axis2-C'
  1. Axis2-C
  2. AXIS2C-1313

Memory leak in axis2_desc_add_child

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.6.0
    • core/description
    • None
    • Win32/64

    Description

      axis2_desc_add_child() overwrites existing children with the same name. These become orphaned and are leaking memory (they'll never get freed).
      Suggestion: Check for an existing child with the same key ad free it before replacing it with the new child:

      AXIS2_EXTERN axis2_status_t AXIS2_CALL
      axis2_desc_add_child(
      const axis2_desc_t * desc,
      const axutil_env_t * env,
      const axis2_char_t * key,
      const void *child)
      {
      if (desc->children)
      {
      /* Added from here */
      axis2_msg_t* msg = (axis2_msg_t *) axutil_hash_get(desc->children, key, AXIS2_HASH_KEY_STRING);
      if ( msg != NULL )

      { axis2_msg_free(msg, env); }

      /* Added to here */
      axutil_hash_set(desc->children, key, AXIS2_HASH_KEY_STRING, child);
      return AXIS2_SUCCESS;
      }
      return AXIS2_FAILURE;
      }

      Attachments

        1. axis2_desc_add_child.diff
          0.6 kB
          Patrick van Beem

        Activity

          People

            manjula peiris Manjula Peiris
            pvbeem Patrick van Beem
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified