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 04:59:34 UTC

[jira] Created: (AXIS2C-872) Function axiom_document_create

Function axiom_document_create
------------------------------

                 Key: AXIS2C-872
                 URL: https://issues.apache.org/jira/browse/AXIS2C-872
             Project: Axis2-C
          Issue Type: Bug
         Environment: Ubuntu 7.04
            Reporter: Lahiru Gunathilake


<snippet>
AXIS2_EXTERN
axiom_document_t* axiom_document_create(
        const axutil_env_t*     env,
        axiom_node_t*           root,
        axiom_stax_builder_t*   builder)
</snippet>

Problem: The return value of type axiom_document_t* takes responsibility for the memory allocated for root. Any child node that is added to root will be free-ed when the function axiom_document_free is called. The return value of type axiom_document_t* does not takes responsibility for the memory allocated for builder (as of v1.1.0, this seems odd, since the internal structure maintains a pointer to builder, but does not free builder. So this may create a dangling pointer situation).

Solution: Document memory ownership for parameters and return value.  Investigate use of pointers in internal structure.

-- 
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] Updated: (AXIS2C-872) Function axiom_document_create[Alastair FETTES]

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

Senaka Fernando updated AXIS2C-872:
-----------------------------------

    Attachment: diff.txt

Hi all,

I don't think that any change was made for 1.1.0 where this is in concern. However, there can be a dangling pointer situation. You can avoid this by applying the proposed patch, which makes it the user's responsibility to avoid the dangling pointer situation. Refer diff.txt for proposed patch.

Regards,
Senaka

> Function axiom_document_create[Alastair FETTES]
> -----------------------------------------------
>
>                 Key: AXIS2C-872
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-872
>             Project: Axis2-C
>          Issue Type: Bug
>         Environment: Ubuntu 7.04
>            Reporter: Lahiru Gunathilake
>         Attachments: diff.txt
>
>
> <snippet>
> AXIS2_EXTERN
> axiom_document_t* axiom_document_create(
>         const axutil_env_t*     env,
>         axiom_node_t*           root,
>         axiom_stax_builder_t*   builder)
> </snippet>
> Problem: The return value of type axiom_document_t* takes responsibility for the memory allocated for root. Any child node that is added to root will be free-ed when the function axiom_document_free is called. The return value of type axiom_document_t* does not takes responsibility for the memory allocated for builder (as of v1.1.0, this seems odd, since the internal structure maintains a pointer to builder, but does not free builder. So this may create a dangling pointer situation).
> Solution: Document memory ownership for parameters and return value.  Investigate use of pointers in internal structure.

-- 
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] Updated: (AXIS2C-872) Function axiom_document_create[Alastair FETTES]

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

Lahiru Gunathilake updated AXIS2C-872:
--------------------------------------

    Summary: Function axiom_document_create[Alastair FETTES]  (was: Function axiom_document_create)

> Function axiom_document_create[Alastair FETTES]
> -----------------------------------------------
>
>                 Key: AXIS2C-872
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-872
>             Project: Axis2-C
>          Issue Type: Bug
>         Environment: Ubuntu 7.04
>            Reporter: Lahiru Gunathilake
>
> <snippet>
> AXIS2_EXTERN
> axiom_document_t* axiom_document_create(
>         const axutil_env_t*     env,
>         axiom_node_t*           root,
>         axiom_stax_builder_t*   builder)
> </snippet>
> Problem: The return value of type axiom_document_t* takes responsibility for the memory allocated for root. Any child node that is added to root will be free-ed when the function axiom_document_free is called. The return value of type axiom_document_t* does not takes responsibility for the memory allocated for builder (as of v1.1.0, this seems odd, since the internal structure maintains a pointer to builder, but does not free builder. So this may create a dangling pointer situation).
> Solution: Document memory ownership for parameters and return value.  Investigate use of pointers in internal structure.

-- 
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-872) Function axiom_document_create[Alastair FETTES]

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

Senaka Fernando commented on AXIS2C-872:
----------------------------------------

Hi again,

Actually, the builder creates the document and then frees it. However, if you create a document and free the builder then the document refers to a non-existent object. This can be avoided by applying the proposed patch.

Regards,
Senaka

> Function axiom_document_create[Alastair FETTES]
> -----------------------------------------------
>
>                 Key: AXIS2C-872
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-872
>             Project: Axis2-C
>          Issue Type: Bug
>         Environment: Ubuntu 7.04
>            Reporter: Lahiru Gunathilake
>         Attachments: diff.txt
>
>
> <snippet>
> AXIS2_EXTERN
> axiom_document_t* axiom_document_create(
>         const axutil_env_t*     env,
>         axiom_node_t*           root,
>         axiom_stax_builder_t*   builder)
> </snippet>
> Problem: The return value of type axiom_document_t* takes responsibility for the memory allocated for root. Any child node that is added to root will be free-ed when the function axiom_document_free is called. The return value of type axiom_document_t* does not takes responsibility for the memory allocated for builder (as of v1.1.0, this seems odd, since the internal structure maintains a pointer to builder, but does not free builder. So this may create a dangling pointer situation).
> Solution: Document memory ownership for parameters and return value.  Investigate use of pointers in internal structure.

-- 
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-872) Function axiom_document_create[Alastair FETTES]

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

Dushshantha Chandradasa resolved AXIS2C-872.
--------------------------------------------

    Resolution: Fixed

> Function axiom_document_create[Alastair FETTES]
> -----------------------------------------------
>
>                 Key: AXIS2C-872
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-872
>             Project: Axis2-C
>          Issue Type: Bug
>         Environment: Ubuntu 7.04
>            Reporter: Lahiru Gunathilake
>         Attachments: diff.txt
>
>
> <snippet>
> AXIS2_EXTERN
> axiom_document_t* axiom_document_create(
>         const axutil_env_t*     env,
>         axiom_node_t*           root,
>         axiom_stax_builder_t*   builder)
> </snippet>
> Problem: The return value of type axiom_document_t* takes responsibility for the memory allocated for root. Any child node that is added to root will be free-ed when the function axiom_document_free is called. The return value of type axiom_document_t* does not takes responsibility for the memory allocated for builder (as of v1.1.0, this seems odd, since the internal structure maintains a pointer to builder, but does not free builder. So this may create a dangling pointer situation).
> Solution: Document memory ownership for parameters and return value.  Investigate use of pointers in internal structure.

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