[ 
https://issues.apache.org/jira/browse/AXIS2C-1664?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Lazarski resolved AXIS2C-1664.
-------------------------------------
    Fix Version/s: 2.0.0
                       (was: 1.7.0)
       Resolution: Fixed

 axutil_param_container_add_param() was calling axutil_hash_set() without
    checking if a param with the same name already existed. Since
    axutil_hash_set() simply overwrites the old value pointer without freeing
    it, this caused a memory leak whenever a parameter was replaced.
    
    Fix: Before adding a param, check if one with the same name exists.
    If so, remove it from the hash table, free it, and invalidate the
    params_list cache. This follows the same pattern used in
    axutil_param_container_delete_param().
    
    Also fixed unconditional add to params_list which could cause duplicates.
    


> Memory leak when replacing value of item in hash table
> ------------------------------------------------------
>
>                 Key: AXIS2C-1664
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-1664
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/transport
>    Affects Versions: 1.7.0
>         Environment: Windows 7
>            Reporter: Seth McCarus
>            Priority: Major
>             Fix For: 2.0.0
>
>
> axis2_libcurl_send() in 
> axis2c\src\core\transport\http\sender\libcurl\axis2_libcurl.c has this call:
> axis2_transport_in_desc_add_param(transport_in, env, 
> param_expose_http_headers);
> this has the effect of replacing the existing "exposeHeaders" parameter in 
> the http transport_in object with a new parameter of the same name.  
> axis2_transport_in_desc_add_param() calls axutil_param_container_add_param(), 
> which calls axutil_hash_set() to replace the param in the hash table.  
> axutil_hash_set has this code:
>             /* replace entry */
>             (*hep)->val = val;
>             /* check that the collision rate isn't too high */
>             if(ht->count > ht->max)
>             {
>                 axutil_hash_expand_array(ht);
>             }
> however the original "val" is not freed, so the existing parameter is leaked. 
>  the proper fix would be to delete val before replacing it, but I'm not sure 
> how that could be done (in my limited knowledge of Axis).  my fix was to 
> delete the exposeHeaders param in axis2_transport_in_desc_add_param by 
> calling axutil_param_container_delete_param before calling 
> axutil_param_container_add_param, but this fixes only the specific case, and 
> not other cases of hash table leaks.
> This was observed in v1.7.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to