axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicholas (Jira)" <>
Subject [jira] [Created] (AXIS2C-1701) Memory leak on duplicate XML namespace declaration
Date Mon, 23 Dec 2019 03:37:00 GMT
Nicholas created AXIS2C-1701:

             Summary: Memory leak on duplicate XML namespace declaration
                 Key: AXIS2C-1701
             Project: Axis2-C
          Issue Type: Bug
          Components: xml/om
    Affects Versions: Current (Nightly)
            Reporter: Nicholas

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:
<S:Envelope xmlns:S="">
  <S:Header xmlns="">
    <To xmlns="">https://localhost/xxx</To>
    <Action xmlns="">ACTION</Action>
  <S:Body />
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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message