This is an automated email from the ASF dual-hosted git repository.

robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-c-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 3d2fd8587 Fix double-free issue in HTTP transport test
3d2fd8587 is described below

commit 3d2fd858762655c1410af3b12d902ad866430d3c
Author: Robert Lazarski <[email protected]>
AuthorDate: Tue Nov 25 04:19:03 2025 -1000

    Fix double-free issue in HTTP transport test
---
 src/core/transport/http/common/http_worker.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/core/transport/http/common/http_worker.c 
b/src/core/transport/http/common/http_worker.c
index 0e8d23242..1c47287e7 100644
--- a/src/core/transport/http/common/http_worker.c
+++ b/src/core/transport/http/common/http_worker.c
@@ -1056,6 +1056,10 @@ axis2_http_worker_process_request(
             axis2_http_simple_response_set_body_stream(response, env,
                 out_stream);
 
+            /* Clear the message context's reference to avoid double-free.
+             * The HTTP response now owns the stream and will be responsible 
for freeing it. */
+            axis2_msg_ctx_reset_transport_out_stream(msg_ctx, env);
+
             stream_len = axutil_stream_get_len (out_stream, env);
             axis2_http_worker_set_response_headers(http_worker, env, svr_conn,
                 simple_request, response,
@@ -1530,6 +1534,10 @@ axis2_http_worker_process_request(
                     {
                         /* This is where we append the message into the http 
back channel.*/
                         axis2_http_simple_response_set_body_stream(response, 
env, out_stream);
+
+                        /* Clear the message context's reference to avoid 
double-free.
+                         * The HTTP response now owns the stream and will be 
responsible for freeing it. */
+                        axis2_msg_ctx_reset_transport_out_stream(msg_ctx, env);
                     }
                 }
             }

Reply via email to