You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2006/11/11 21:35:47 UTC

svn commit: r473794 - in /webservices/axis2/trunk/c/axiom: include/axiom_attribute.h src/om/om_attribute.c src/om/om_element.c

Author: dinesh
Date: Sat Nov 11 12:35:46 2006
New Revision: 473794

URL: http://svn.apache.org/viewvc?view=rev&rev=473794
Log:
fixed:axis2c-396 element free segfaults if attributes reused

Modified:
    webservices/axis2/trunk/c/axiom/include/axiom_attribute.h
    webservices/axis2/trunk/c/axiom/src/om/om_attribute.c
    webservices/axis2/trunk/c/axiom/src/om/om_element.c

Modified: webservices/axis2/trunk/c/axiom/include/axiom_attribute.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/include/axiom_attribute.h?view=diff&rev=473794&r1=473793&r2=473794
==============================================================================
--- webservices/axis2/trunk/c/axiom/include/axiom_attribute.h (original)
+++ webservices/axis2/trunk/c/axiom/include/axiom_attribute.h Sat Nov 11 12:35:46 2006
@@ -166,7 +166,8 @@
     typedef struct axiom_attribute
     {
         /** ops of attribute struct */
-        axiom_attribute_ops_t *ops;
+	  axiom_attribute_ops_t *ops;
+	  int ref;
        
     } axiom_attribute_t;
 

Modified: webservices/axis2/trunk/c/axiom/src/om/om_attribute.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/om/om_attribute.c?view=diff&rev=473794&r1=473793&r2=473794
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/om/om_attribute.c (original)
+++ webservices/axis2/trunk/c/axiom/src/om/om_attribute.c Sat Nov 11 12:35:46 2006
@@ -159,6 +159,7 @@
     attribute_impl->om_attribute.ops->set_value = axiom_attribute_set_value;
 
     attribute_impl->om_attribute.ops->clone = axiom_attribute_clone;
+    attribute_impl->om_attribute.ref = 0;
     return &(attribute_impl->om_attribute);
 }
 
@@ -168,6 +169,9 @@
         const axis2_env_t *env)
 {
     axiom_attribute_impl_t *attribute_impl = NULL;
+
+    if (--om_attribute->ref > 0)
+	  return AXIS2_SUCCESS;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     attribute_impl = AXIS2_INTF_TO_IMPL(om_attribute);

Modified: webservices/axis2/trunk/c/axiom/src/om/om_element.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/om/om_element.c?view=diff&rev=473794&r1=473793&r2=473794
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/om/om_element.c (original)
+++ webservices/axis2/trunk/c/axiom/src/om/om_element.c Sat Nov 11 12:35:46 2006
@@ -828,6 +828,7 @@
                 name, AXIS2_HASH_KEY_STRING,
                 attribute);
     }
+    attribute->ref++;
     return ((qname) ? AXIS2_SUCCESS : AXIS2_FAILURE);
 }
 



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