[ 
https://issues.apache.org/jira/browse/AXIS2C-1217?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Lazarski resolved AXIS2C-1217.
-------------------------------------
    Fix Version/s: 2.0.0
                       (was: 1.7.0)
       Resolution: Fixed

  The issue reported multiple memory leaks on the client side. Upon 
investigation, I found and fixed three issues in 
src/core/transport/http/sender/http_sender.c:

  1. Logic bug with keep_alive handling (lines 460-473): The original code had 
if(sender->client && sender->keep_alive) which incorrectly returned 
AXIS2_FAILURE when keep_alive was FALSE even though the client was successfully 
created. Fixed by separating the failure check from the keep_alive logic.
  2. String literal being freed (line 218): http_version was initialized to a 
string literal AXIS2_HTTP_HEADER_PROTOCOL_11, but later freed in 
axis2_http_sender_free. This is undefined behavior. Fixed by using 
axutil_strdup to allocate proper memory.
  3. Memory leak in set_http_version (line 1788): The 
axis2_http_sender_set_http_version function replaced http_version without 
freeing the old value first, causing a memory leak every time the HTTP version 
was changed. Fixed by freeing the old value before allocating the new one.

  The other leaks mentioned in the original JIRA (qname leaks in stubs) were 
already fixed by a previous commit (AXIS2C-1542) which added proper 
axutil_qname_free calls in generated stub code.

  All tests pass:
  - Unit tests: All passed (including the ASAN memory leak detection)
  - Native generator tests: 75/75 (100%)


> multiple memory leaks  on the client side
> -----------------------------------------
>
>                 Key: AXIS2C-1217
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-1217
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/engine
>         Environment: linux fc6
>            Reporter: Frederic Heem
>            Priority: Major
>             Fix For: 2.0.0
>
>
> Memory leaks are present on the client side for In-Only and In-Out,
> Here is the output for In-Only MEP:
> ==23643== 30 (16 direct, 14 indirect) bytes in 1 blocks are definitely lost 
> in loss record 8 of 24
> ==23643==    at 0x4005858: malloc (vg_replace_malloc.c:207)
> ==23643==    by 0x411C7EC: axutil_string_create (string.c:52)
> ==23643==    by 0x804D7B2: axis2_stub_op_zigbee_PermitJoining 
> (axis2_stub_zigbee.c:1637)
> ==23643==    by 0x804AFE5: PermitJoining (zigbee_client.c:408)
> ==23643==    by 0x804B58A: main (zigbee_client.c:198)
> ==23643==
> ==23643==
> ==23643== 44 bytes in 1 blocks are definitely lost in loss record 10 of 24
> ==23643==    at 0x4005858: malloc (vg_replace_malloc.c:207)
> ==23643==    by 0x411A1D5: axutil_stream_create_internal (stream.c:84)
> ==23643==    by 0x411A28C: axutil_stream_create_socket (stream.c:510)
> ==23643==    by 0x4098C31: axis2_http_client_send (http_client.c:239)
> ==23643==    by 0x4096743: axis2_http_sender_send (http_sender.c:1064)
> ==23643==    by 0x40912F4: axis2_http_transport_sender_write_message 
> (http_transport_sender.c:771)
> ==23643==    by 0x4091C9D: axis2_http_transport_sender_invoke 
> (http_transport_sender.c:306)
> ==23643==    by 0x402CD36: axis2_engine_send (engine.c:176)
> ==23643==    by 0x4053E37: axis2_op_client_two_way_send (op_client.c:1157)
> ==23643==    by 0x405567C: axis2_op_client_execute (op_client.c:504)
> ==23643==    by 0x405756F: axis2_svc_client_send_robust_with_op_qname 
> (svc_client.c:595)
> ==23643==    by 0x804D747: axis2_stub_op_zigbee_PermitJoining 
> (axis2_stub_zigbee.c:1647)
> ==23643==
> ==23643==
> ==23643== 1,076 (280 direct, 796 indirect) bytes in 14 blocks are definitely 
> lost in loss record 14 of 24
> ==23643==    at 0x4005858: malloc (vg_replace_malloc.c:207)
> ==23643==    by 0x411D100: axutil_qname_create (qname.c:62)
> ==23643==    by 0x804F3B9: axis2_stub_populate_services_for_zigbee 
> (axis2_stub_zigbee.c:82)
> ==23643==    by 0x80500DA: axis2_stub_create_zigbee (axis2_stub_zigbee.c:45)
> ==23643==    by 0x804B3E8: main (zigbee_client.c:185)
> ==23643==
> ==23643==
> ==23643== 42,443 (1,664 direct, 40,779 indirect) bytes in 52 blocks are 
> definitely lost in loss record 21 of 24
> ==23643==    at 0x4005858: malloc (vg_replace_malloc.c:207)
> ==23643==    by 0x40371B8: axis2_msg_create (msg.c:59)
> ==23643==    by 0x402F7A5: axis2_op_create (op.c:104)
> ==23643==    by 0x402FBE2: axis2_op_create_with_qname (op.c:179)
> ==23643==    by 0x804F3C5: axis2_stub_populate_services_for_zigbee 
> (axis2_stub_zigbee.c:86)
> ==23643==    by 0x80500DA: axis2_stub_create_zigbee (axis2_stub_zigbee.c:45)
> ==23643==    by 0x804B3E8: main (zigbee_client.c:185)
> Here is the output for In-Out MEP:
> ==23723== 1,000 (260 direct, 740 indirect) bytes in 13 blocks are definitely 
> lost in loss record 11 of 21
> ==23723==    at 0x4005858: malloc (vg_replace_malloc.c:207)
> ==23723==    by 0x411D100: axutil_qname_create (qname.c:62)
> ==23723==    by 0x804F3B9: axis2_stub_populate_services_for_zigbee 
> (axis2_stub_zigbee.c:82)
> ==23723==    by 0x80500DA: axis2_stub_create_zigbee (axis2_stub_zigbee.c:45)
> ==23723==    by 0x804B3E8: main (zigbee_client.c:185)
> ==23723==
> ==23723==
> ==23723== 42,443 (1,664 direct, 40,779 indirect) bytes in 52 blocks are 
> definitely lost in loss record 18 of 21
> ==23723==    at 0x4005858: malloc (vg_replace_malloc.c:207)
> ==23723==    by 0x40371B8: axis2_msg_create (msg.c:59)
> ==23723==    by 0x402F7A5: axis2_op_create (op.c:104)
> ==23723==    by 0x402FBE2: axis2_op_create_with_qname (op.c:179)
> ==23723==    by 0x804F3C5: axis2_stub_populate_services_for_zigbee 
> (axis2_stub_zigbee.c:86)
> ==23723==    by 0x80500DA: axis2_stub_create_zigbee (axis2_stub_zigbee.c:45)
> ==23723==    by 0x804B3E8: main (zigbee_client.c:185)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to