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

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

The fix applies the same patch from the JIRA attachment - changing 
axiom_element_find_namespace() to axiom_element_find_declared_namespace() so 
duplicate namespace declarations from parent elements are redeclared locally 
with proper ownership, preventing the memory leak.


> Memory leak on duplicate XML namespace declaration
> --------------------------------------------------
>
>                 Key: AXIS2C-1701
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-1701
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: xml/om
>            Reporter: Nicholas
>            Priority: Minor
>             Fix For: 2.0.0
>
>         Attachments: axis.zip
>
>
> A memory leak exists in the axiom_element_declare_namespace function if the 
> namespace exists in the parent hierarchy. For example when decoding this 
> message:
> {code:java}
> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/";>
>   <S:Header xmlns="http://www.w3.org/2005/08/addressing";>
>     <To 
> xmlns="http://www.w3.org/2005/08/addressing";>https://localhost/xxx</To>
>     <Action xmlns="http://www.w3.org/2005/08/addressing";>ACTION</Action>
>     <MessageID>XXXX</MessageID>"
>   </S:Header>
>   <S:Body />
> </S:Envelope>{code}
> The duplicate namespace declarations in the "To" and "Action" elements result 
> in the leak of 2 namespace objects and their strings.
> Callers of the function expect that if it returns SUCCESS the namespace 
> parameter is now owned by the element and then don't free it. But if the 
> namespace has already been declared in a parent element it returns SUCCESS 
> without changing the ref count of the parameter.
> A real fix would require changing the API so my quick fix is to only search 
> the current element for a matching namespace and if not found it can be 
> redeclared. Attached is a reproducer and a patch.



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