[
https://issues.apache.org/jira/browse/AXIS2C-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Patrick van Beem updated AXIS2C-1313:
-------------------------------------
Attachment: axis2_desc_add_child.diff
> Memory leak in axis2_desc_add_child
> -----------------------------------
>
> Key: AXIS2C-1313
> URL: https://issues.apache.org/jira/browse/AXIS2C-1313
> Project: Axis2-C
> Issue Type: Bug
> Components: core/description
> Environment: Win32/64
> Reporter: Patrick van Beem
> Fix For: Current (Nightly)
>
> Attachments: axis2_desc_add_child.diff
>
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> 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;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]