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 na...@apache.org on 2006/03/17 12:10:13 UTC

svn commit: r386607 - /webservices/axis2/trunk/c/modules/xml/soap/soap_header.c

Author: nandika
Date: Fri Mar 17 03:10:10 2006
New Revision: 386607

URL: http://svn.apache.org/viewcvs?rev=386607&view=rev
Log:
memory leak fixed 

Modified:
    webservices/axis2/trunk/c/modules/xml/soap/soap_header.c

Modified: webservices/axis2/trunk/c/modules/xml/soap/soap_header.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap_header.c?rev=386607&r1=386606&r2=386607&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap_header.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap_header.c Fri Mar 17 03:10:10 2006
@@ -21,7 +21,9 @@
  #include <axis2_soap.h>
  #include <axis2_soap_builder.h>
  #include <stdio.h>
- #include <axis2_om_node_internal.h> 
+ #include <axis2_om_node_internal.h>
+ #include <axis2_array_list.h>
+ 
  /******************* impl struct *********************************************/
  
  typedef struct axis2_soap_header_impl_t
@@ -38,6 +40,8 @@
     
     axis2_soap_builder_t *soap_builder;
     
+    axis2_array_list_t *header_block_keys;
+    
  }axis2_soap_header_impl_t;
  
  /****************** Macro ****************************************************/
@@ -113,6 +117,7 @@
     header_impl->header_blocks = NULL;
     /** default value */
     header_impl->soap_version = AXIS2_SOAP12;
+    header_impl->header_block_keys = NULL;
     
     
     header_impl->soap_header.ops = NULL;
@@ -125,6 +130,14 @@
         return NULL;
     }
     
+    header_impl->header_block_keys = axis2_array_list_create(env, 10);
+    if(!header_impl->header_block_keys)
+    {
+        AXIS2_FREE((*env)->allocator, header_impl->soap_header.ops);
+        AXIS2_FREE((*env)->allocator, header_impl);
+        return NULL;
+    }
+    
     header_impl->soap_header.ops->free_fn =
         axis2_soap_header_free;
     header_impl->soap_header.ops->add_header_block =
@@ -237,6 +250,24 @@
         
         axis2_hash_free (header_impl->header_blocks, env);
     }
+    if(NULL != header_impl->header_block_keys)
+    {
+        int size = 0;
+        void *val = NULL;
+        int i = 0;
+        size = AXIS2_ARRAY_LIST_SIZE(header_impl->header_block_keys, env);
+        for(i = 0; i< size; i++)
+        {
+            val = AXIS2_ARRAY_LIST_GET(header_impl->header_block_keys, env, i);
+            if(NULL != val)
+            {
+                AXIS2_FREE((*env)->allocator, (char*)val);
+                val = NULL;
+            }
+        }
+        AXIS2_ARRAY_LIST_FREE(header_impl->header_block_keys, env);
+        header_impl->header_block_keys = NULL;
+    }
     if(NULL != header->ops)
     {
         AXIS2_FREE((*env)->allocator, header->ops);
@@ -464,6 +495,10 @@
             header_impl->header_blocks = axis2_hash_make(env);
             axis2_hash_set(header_impl->header_blocks,
                 key , AXIS2_HASH_KEY_STRING, header_block);
+    }
+    if(NULL != header_impl->header_block_keys)
+    {
+        AXIS2_ARRAY_LIST_ADD(header_impl->header_block_keys, env, key);
     }
     return AXIS2_SUCCESS;