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 "Sebastian Brandt (JIRA)" <ji...@apache.org> on 2012/04/30 13:34:48 UTC

[jira] [Created] (AXIS2C-1590) axiom_attribute reference counting broken

Sebastian Brandt created AXIS2C-1590:
----------------------------------------

             Summary: axiom_attribute reference counting broken
                 Key: AXIS2C-1590
                 URL: https://issues.apache.org/jira/browse/AXIS2C-1590
             Project: Axis2-C
          Issue Type: Bug
          Components: xml/om
    Affects Versions: 1.7.0
            Reporter: Sebastian Brandt


The reference counting in axiom_attribute seems to be broken.
When created, om_element has ref = 0.
When free is called the first time,     
  if(--attribute->ref > 0)
evaluates to false; thus, the instance is freed. so far ok.

When axiom_attribute_increment_ref is called, the ref count is incremented.
if axiom_attribute_free is called now, again,   if(--attribute->ref > 0) evaluates to false, and the instance is freed.

Now, which is the right way to use the instance?
a) call _create, and _free
b) call _create, _increment_ref, and _free once?
c) call _create, _increment_ref, and _free twice? (currently results in duplicate free).

As far as I can see, a and b both happen, though I'm sure the b case looks rather like having forgotten to call _free a second time.

axiom_element_add_attribute:
    axutil_hash_set(om_element->attributes, name, AXIS2_HASH_KEY_STRING, attribute);
    axiom_attribute_increment_ref(attribute, env);
axiom_element_free:
    for each attribute in ->attributes:
        axiom_attribute_free((axiom_attribute_t *)val, env);
for _these_ attributes, no other call to axiom_attribute_free is done.

In other cases, _create and _free is called without increment_ref.






--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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