You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Lahiru Gunathilake (JIRA)" <ji...@apache.org> on 2008/01/04 05:23:35 UTC

[jira] Created: (AXIS2C-881) Function axis2_svc_client_remove_all_headers [Alastair FETTES]

Function axis2_svc_client_remove_all_headers [Alastair FETTES]
--------------------------------------------------------------

                 Key: AXIS2C-881
                 URL: https://issues.apache.org/jira/browse/AXIS2C-881
             Project: Axis2-C
          Issue Type: Bug
          Components: core/clientapi
    Affects Versions: Current (Nightly)
         Environment: Ubuntu
            Reporter: Lahiru Gunathilake
             Fix For: Current (Nightly)


<snippet>
AXIS2_EXTERN
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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Resolved: (AXIS2C-881) Function axis2_svc_client_remove_all_headers [Alastair FETTES]

Posted by "Senaka Fernando (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-881?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Senaka Fernando resolved AXIS2C-881.
------------------------------------

    Resolution: Fixed

Issue Fixed. Thanks Lahiru and Alastair for the input.

> Function axis2_svc_client_remove_all_headers [Alastair FETTES]
> --------------------------------------------------------------
>
>                 Key: AXIS2C-881
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-881
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/clientapi
>    Affects Versions: Current (Nightly)
>         Environment: Ubuntu
>            Reporter: Lahiru Gunathilake
>            Assignee: Senaka Fernando
>             Fix For: Current (Nightly)
>
>
> <snippet>
> AXIS2_EXTERN
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Commented: (AXIS2C-881) Function axis2_svc_client_remove_all_headers [Alastair FETTES]

Posted by "Senaka Fernando (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2C-881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12555814#action_12555814 ] 

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 is,

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

Regards,
Senaka

> Function axis2_svc_client_remove_all_headers [Alastair FETTES]
> --------------------------------------------------------------
>
>                 Key: AXIS2C-881
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-881
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/clientapi
>    Affects Versions: Current (Nightly)
>         Environment: Ubuntu
>            Reporter: Lahiru Gunathilake
>             Fix For: Current (Nightly)
>
>
> <snippet>
> AXIS2_EXTERN
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Issue Comment Edited: (AXIS2C-881) Function axis2_svc_client_remove_all_headers [Alastair FETTES]

Posted by "Senaka Fernando (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2C-881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12555814#action_12555814 ] 

senakafdo edited comment on AXIS2C-881 at 1/3/08 9:57 PM:
----------------------------------------------------------------

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 is,

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_remove(svc_client->headers, env, i); 
                                                          /* this removes and retrieves data */
            i--;
            size--;
            if (node)
            {
                   axiom_node_add_child(header_node, env, node);
            }
      }
}

Regards,
Senaka

      was (Author: senakafdo):
    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 is,

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

Regards,
Senaka
  
> Function axis2_svc_client_remove_all_headers [Alastair FETTES]
> --------------------------------------------------------------
>
>                 Key: AXIS2C-881
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-881
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/clientapi
>    Affects Versions: Current (Nightly)
>         Environment: Ubuntu
>            Reporter: Lahiru Gunathilake
>             Fix For: Current (Nightly)
>
>
> <snippet>
> AXIS2_EXTERN
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Assigned: (AXIS2C-881) Function axis2_svc_client_remove_all_headers [Alastair FETTES]

Posted by "Senaka Fernando (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-881?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Senaka Fernando reassigned AXIS2C-881:
--------------------------------------

    Assignee: Senaka Fernando

> Function axis2_svc_client_remove_all_headers [Alastair FETTES]
> --------------------------------------------------------------
>
>                 Key: AXIS2C-881
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-881
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/clientapi
>    Affects Versions: Current (Nightly)
>         Environment: Ubuntu
>            Reporter: Lahiru Gunathilake
>            Assignee: Senaka Fernando
>             Fix For: Current (Nightly)
>
>
> <snippet>
> AXIS2_EXTERN
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org