axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Darroch (JIRA)" <j...@apache.org>
Subject [jira] Created: (AXIS2C-394) element free segfaults if namespace reused
Date Tue, 07 Nov 2006 00:37:37 GMT
element free segfaults if namespace reused
------------------------------------------

                 Key: AXIS2C-394
                 URL: http://issues.apache.org/jira/browse/AXIS2C-394
             Project: Axis2-C
          Issue Type: Bug
          Components: xml/om
    Affects Versions: 0.95
            Reporter: Chris Darroch


If you create a namespace with axiom_namespace_create() and then create two
sibling elements using axiom_element_create(), passing them both the namespace pointer,
then both elements add the namespace pointer to their internal namespace hash,
because neither finds declated it in any of the ancerstor elements.

Then when you call axiom_node_free_tree(), you get a segfault when axiom_element_free() runs
for the second element, because it calls axiom_namespace_free() on a namespace that
the first element already freed.  Both elements treat the namespace as if it was private to
themselves and add it to their internal namespace hashes, and then both try to free it.

I think some kind of reference counting will be required here.  I'll try to make up a patch
tonight
and post it here.

If I may just say so, though ... this is why trying to do alloc/free on everything is hard!
 It would
be so much easier if you were using APR memory pools!  Then you could make lots of
pointers (like these internal namespace hash pointers) and not worry about reference
counting, and when you were *totally* done with everything, just clear or destroy the pool.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


Mime
View raw message