You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2006/03/20 05:07:14 UTC

svn commit: r387130 - in /webservices/axis2/trunk/c/modules: core/transport/http/ core/transport/http/sender/ util/

Author: sahan
Date: Sun Mar 19 20:07:12 2006
New Revision: 387130

URL: http://svn.apache.org/viewcvs?rev=387130&view=rev
Log:
Removed some memory leaks

Modified:
    webservices/axis2/trunk/c/modules/core/transport/http/http_chunked_stream.c
    webservices/axis2/trunk/c/modules/core/transport/http/http_status_line.c
    webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c
    webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c
    webservices/axis2/trunk/c/modules/core/transport/http/url.c
    webservices/axis2/trunk/c/modules/util/axis2_hash.h
    webservices/axis2/trunk/c/modules/util/hash.c

Modified: webservices/axis2/trunk/c/modules/core/transport/http/http_chunked_stream.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/http_chunked_stream.c?rev=387130&r1=387129&r2=387130&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/http_chunked_stream.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/http_chunked_stream.c Sun Mar 19 20:07:12 2006
@@ -177,7 +177,7 @@
 			chunked_stream_impl->unread_len -= len;
 		}	
 	}
-    return count - yet_to_read;    
+    return count - yet_to_read;
 }
 
 int AXIS2_CALL

Modified: webservices/axis2/trunk/c/modules/core/transport/http/http_status_line.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/http_status_line.c?rev=387130&r1=387129&r2=387130&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/http_status_line.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/http_status_line.c Sun Mar 19 20:07:12 2006
@@ -213,8 +213,8 @@
         AXIS2_FREE((*env)->allocator, status_line_impl->reason_phrase);
         status_line_impl->reason_phrase = NULL;
     }     
-    /*if(NULL != status_line->ops)
-        AXIS2_FREE((*env)->allocator, status_line->ops);*/
+    if(NULL != status_line->ops)
+        AXIS2_FREE((*env)->allocator, status_line->ops);
     
 	AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(status_line));
 	return AXIS2_SUCCESS;

Modified: webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c?rev=387130&r1=387129&r2=387130&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c Sun Mar 19 20:07:12 2006
@@ -252,6 +252,7 @@
 
     property = axis2_property_create(env);
     AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_REQUEST);
+    AXIS2_PROPERTY_SET_FREE_FUNC(property, env, axis2_hash_free_void_arg);
     headers = axis2_http_worker_get_headers(http_worker, env, simple_request);
     AXIS2_PROPERTY_SET_VALUE(property, env, headers);
 	AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, AXIS2_TRANSPORT_HEADERS, property, 
@@ -261,7 +262,8 @@
 
     property = axis2_property_create(env);
     AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_REQUEST);
-    AXIS2_PROPERTY_SET_FREE_FUNC(property, env, axis2_http_out_transport_info_free_void_arg);
+    AXIS2_PROPERTY_SET_FREE_FUNC(property, env, 
+                        axis2_http_out_transport_info_free_void_arg);
     http_out_transport_info = axis2_http_out_transport_info_create(env, response);
     AXIS2_PROPERTY_SET_VALUE(property, env, http_out_transport_info);
 	AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, AXIS2_HTTP_OUT_TRANSPORT_INFO,

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c?rev=387130&r1=387129&r2=387130&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c Sun Mar 19 20:07:12 2006
@@ -154,20 +154,7 @@
     {
         AXIS2_FREE((*env)->allocator, sender_impl->http_version);
         sender_impl->http_version= NULL;
-    }
-    /* This is a shallow copy, thus should not be freed - Samisa
-    if(NULL != sender_impl->om_output)
-    {
-        AXIS2_OM_OUTPUT_FREE(sender_impl->om_output, env);
-        sender_impl->om_output = NULL;
-    }*/
-
-    /*if (sender_impl->client)
-    {
-        AXIS2_HTTP_CLIENT_FREE(sender_impl->client, env);
-        sender_impl->client = NULL;
-    }*/
-    
+    }    
     if(NULL != sender->ops)
         AXIS2_FREE((*env)->allocator, sender->ops);
     

Modified: webservices/axis2/trunk/c/modules/core/transport/http/url.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/url.c?rev=387130&r1=387129&r2=387130&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/url.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/url.c Sun Mar 19 20:07:12 2006
@@ -92,9 +92,19 @@
 	{
     	url_impl->server = (axis2_char_t *)AXIS2_STRDUP(server, env);
 	}
+    /** if the path is not starting with / we have to make it so
+     */
 	if(NULL != path)
 	{
-    	url_impl->path = (axis2_char_t *)AXIS2_STRDUP(path, env);
+        if(path[0] == '/')
+        {
+            url_impl->path = (axis2_char_t *)AXIS2_STRDUP(path, env);
+        }
+        else
+        {
+            url_impl->path = AXIS2_STRACAT("/", path, env);
+        }
+    	
 	}
 	     
     url_impl->url.ops = AXIS2_MALLOC((*env)->allocator,sizeof(axis2_url_ops_t));

Modified: webservices/axis2/trunk/c/modules/util/axis2_hash.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/axis2_hash.h?rev=387130&r1=387129&r2=387130&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/axis2_hash.h (original)
+++ webservices/axis2/trunk/c/modules/util/axis2_hash.h Sun Mar 19 20:07:12 2006
@@ -220,7 +220,15 @@
 AXIS2_DECLARE(axis2_status_t) axis2_hash_free(axis2_hash_t *ht
 		, axis2_env_t **environment);
 									
+/**
+ * Free a hash table with hash table given as void
+ * @param ht hash table to be freed as a void *
+ * @param environment The environment to use for hash table
+ * @return return status code
+ */
 
+AXIS2_DECLARE(axis2_status_t)
+axis2_hash_free_void_arg (void *ht_void, axis2_env_t** environment);
 
 /** @} */
 

Modified: webservices/axis2/trunk/c/modules/util/hash.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/hash.c?rev=387130&r1=387129&r2=387130&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/hash.c (original)
+++ webservices/axis2/trunk/c/modules/util/hash.c Sun Mar 19 20:07:12 2006
@@ -537,3 +537,25 @@
     }
     return AXIS2_FAILURE;
 }
+
+AXIS2_DECLARE(axis2_status_t)
+axis2_hash_free_void_arg (void *ht_void, axis2_env_t** environment)
+{
+    int i =0;
+    axis2_hash_t *ht = (axis2_hash_t*)ht_void;
+    AXIS2_ENV_CHECK(environment, AXIS2_FAILURE);
+    if (ht)
+    {
+        for(i = 0;i <ht->max; i++)
+        {
+            if(ht->array[i])
+            {
+                AXIS2_FREE((*environment)->allocator, ht->array[i]);
+            }
+        }
+        AXIS2_FREE((*environment)->allocator, (ht->array));
+        AXIS2_FREE ((*environment)->allocator, ht);
+        return AXIS2_SUCCESS;
+    }
+    return AXIS2_FAILURE;
+}