axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mili...@apache.org
Subject svn commit: r659544 - /webservices/axis2/trunk/c/util/src/url.c
Date Fri, 23 May 2008 14:05:52 GMT
Author: milinda
Date: Fri May 23 07:05:51 2008
New Revision: 659544

URL: http://svn.apache.org/viewvc?rev=659544&view=rev
Log:
Fixing memory leaks caused by axutil_url_encode function.

Modified:
    webservices/axis2/trunk/c/util/src/url.c

Modified: webservices/axis2/trunk/c/util/src/url.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/url.c?rev=659544&r1=659543&r2=659544&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/url.c (original)
+++ webservices/axis2/trunk/c/util/src/url.c Fri May 23 07:05:51 2008
@@ -630,7 +630,8 @@
     axis2_char_t *buff, int len)
 {
     axis2_char_t string[4];
-    axis2_char_t *expand_buffer;
+    axis2_char_t *expand_buffer = NULL;
+	axis2_char_t *temp = NULL;
     int i;
     for (i = 0; i < len && buff[i]; i++)
     {
@@ -650,7 +651,13 @@
                 (axis2_char_t *) AXIS2_MALLOC (env->allocator, len * 2);
             memset (expand_buffer, 0, len * 2);
             len *= 2;
-            dest = memmove (expand_buffer, dest, strlen (dest));
+            temp = memmove (expand_buffer, dest, strlen (dest));
+			if(dest)
+			{
+				AXIS2_FREE(env->allocator, dest);
+				dest = NULL;
+			}
+			dest = temp;
         }
         strcat (dest, string);
     }



Mime
View raw message