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 se...@apache.org on 2008/03/05 18:08:22 UTC
svn commit: r633934 - /webservices/axis2/trunk/c/util/src/uri.c
Author: senaka
Date: Wed Mar 5 09:08:20 2008
New Revision: 633934
URL: http://svn.apache.org/viewvc?rev=633934&view=rev
Log:
Fixing Memory leaks in uri.c
Modified:
webservices/axis2/trunk/c/util/src/uri.c
Modified: webservices/axis2/trunk/c/util/src/uri.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/uri.c?rev=633934&r1=633933&r2=633934&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/uri.c (original)
+++ webservices/axis2/trunk/c/util/src/uri.c Wed Mar 5 09:08:20 2008
@@ -657,7 +657,7 @@
{
size_t baselen;
const char *basepath = base->path ? base->path : "/";
- const char *path = uri->path;
+ char *path = uri->path;
const char *base_end = strrchr(basepath, '/');
/* if base is nonsensical, bail out */
@@ -688,6 +688,10 @@
sizeof(axis2_char_t) * baselen + strlen(path) + 1);
memcpy(uri->path, basepath, baselen);
strcpy(uri->path + baselen, path);
+ if (path)
+ {
+ AXIS2_FREE(env->allocator, path);
+ }
}
/* The trivial bits are everything-but-path */
@@ -735,13 +739,20 @@
const char *uri)
{
axutil_uri_t *uptr = NULL;
+ axutil_uri_t *temp = NULL;
uptr = axutil_uri_parse_string(env, uri);
if (!uptr && AXIS2_SUCCESS != AXIS2_ERROR_GET_STATUS_CODE(env->error))
{
return uptr;
}
+ temp = uptr;
uptr = axutil_uri_resolve_relative(env, base, uptr);
+
+ if (!uptr)
+ {
+ axutil_uri_free(temp, env);
+ }
return uptr;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org