axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Senaka Fernando (JIRA)" <>
Subject [jira] Commented: (AXIS2C-881) Function axis2_svc_client_remove_all_headers [Alastair FETTES]
Date Fri, 04 Jan 2008 05:52:34 GMT


Senaka Fernando commented on AXIS2C-881:

Hi all,

I think we are referring to this code block in, axis2_svc_client_fill_soap_envelope

if (header_node)
      int size = 0;
      int i = 0;
      size = axutil_array_list_size(svc_client->headers, env);
      for (i = 0; i < size; i++)
            axiom_node_t *node = NULL;
            node = axutil_array_list_get(svc_client->headers, env, i);
            if (node)
                   axiom_node_add_child(header_node, env, node);

This block is leading to a dangling pointer situation. While adding nodes into the payload
we have to remove it from the array_list. But, this is not happening. The suggested modification

            if (node)
                   axiom_node_add_child(header_node, env, node);
                   axutil_array_list_remove(svc_client->headers, env, i);


> Function axis2_svc_client_remove_all_headers [Alastair FETTES]
> --------------------------------------------------------------
>                 Key: AXIS2C-881
>                 URL:
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/clientapi
>    Affects Versions: Current (Nightly)
>         Environment: Ubuntu
>            Reporter: Lahiru Gunathilake
>             Fix For: Current (Nightly)
> <snippet>
> axis2_status_t axis2_svc_client_remove_all_headers(
>       axis2_svc_client_t*    svc_client,
>       const axutil_env_t*    env)
> </snippet>
> This function does not take responsibility for the memory allocated to the pointers passed
to it. In addition, the memory passed to the function axis2_svc_client_add_header through
the parameter header is not de-allocated by this function (axis2_svc_client_remove_all_headers).
This can create a possible memory leak. When in used in conjunction with a call to axis2_svc_client_send_receive_non_blocking,
this is not a problem as this function will clean up the headers itself (this is assumed,
since when you free the header nodes, an access violations occur when the SOAP message is
sent and the calling function tries to free the SOAP message data, i.e. the header nodes).
> Solution: Document memory ownership for parameters and return value.  Investigate potential
memory leak. 

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:
For additional commands, e-mail:

View raw message