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/22 12:24:35 UTC
svn commit: r387836 - in
/webservices/axis2/trunk/c/modules/core/transport/http:
http_simple_request.c sender/soap_over_http_sender.c
Author: sahan
Date: Wed Mar 22 03:24:31 2006
New Revision: 387836
URL: http://svn.apache.org/viewcvs?rev=387836&view=rev
Log:
Memory leak fixes again
Modified:
webservices/axis2/trunk/c/modules/core/transport/http/http_simple_request.c
webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c
Modified: webservices/axis2/trunk/c/modules/core/transport/http/http_simple_request.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/http_simple_request.c?rev=387836&r1=387835&r2=387836&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/http_simple_request.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/http_simple_request.c Wed Mar 22 03:24:31 2006
@@ -33,6 +33,7 @@
axis2_http_request_line_t *request_line;
axis2_array_list_t *header_group;
axis2_stream_t *stream;
+ axis2_bool_t owns_stream;
};
#define AXIS2_INTF_TO_IMPL(simple_request) \
@@ -135,6 +136,7 @@
simple_request_impl->request_line = request_line;
simple_request_impl->stream = content;
simple_request_impl->header_group = NULL;
+ simple_request_impl->owns_stream = AXIS2_FALSE;
if(http_hdr_count > 0 && NULL != http_headers)
{
int i = 0;
@@ -200,6 +202,11 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
simple_request_impl = AXIS2_INTF_TO_IMPL(simple_request);
+ if(AXIS2_TRUE == simple_request_impl->owns_stream)
+ {
+ AXIS2_STREAM_FREE(simple_request_impl->stream, env);
+ simple_request_impl->stream = NULL;
+ }
/*
Don't free the stream since it belongs to the socket
TODO : if chunked remove the chunked stream.
@@ -550,6 +557,7 @@
return AXIS2_FAILURE;
}
AXIS2_INTF_TO_IMPL(simple_request)->stream = body_stream;
+ AXIS2_INTF_TO_IMPL(simple_request)->owns_stream = AXIS2_TRUE;
}
AXIS2_STREAM_WRITE(body_stream, env, str, AXIS2_STRLEN(str));
return AXIS2_SUCCESS;
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=387836&r1=387835&r2=387836&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 Wed Mar 22 03:24:31 2006
@@ -233,6 +233,13 @@
AXIS2_SOAP_ENVELOPE_SERIALIZE (out, env, sender_impl->om_output,
AXIS2_FALSE);
buffer = AXIS2_XML_WRITER_GET_XML(xml_writer, env);
+
+ if(NULL == buffer)
+ {
+ AXIS2_LOG_ERROR((*env)->log, AXIS2_LOG_SI, "NULL xml returned"
+ "from xml writer");
+ return AXIS2_FAILURE;
+ }
request_line = axis2_http_request_line_create(env, "POST",
AXIS2_URL_GET_PATH(url, env),
@@ -287,6 +294,9 @@
sender_impl->so_timeout);
status_code = AXIS2_HTTP_CLIENT_SEND(sender_impl->client, env, request);
+
+ AXIS2_FREE((*env)->allocator, buffer);
+ buffer = NULL;
AXIS2_HTTP_SIMPLE_REQUEST_FREE(request, env);
request = NULL;