Nicholas created AXIS2C-1701: -------------------------------- Summary: 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 Affects Versions: Current (Nightly) Reporter: Nicholas 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.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: c-dev-unsubscr...@axis.apache.org For additional commands, e-mail: c-dev-h...@axis.apache.org