---

** [tickets:#1220] amf : memory leak reported by valgrind in ava_mds.c**

**Status:** accepted
**Milestone:** 4.4.2
**Created:** Tue Nov 25, 2014 08:44 AM UTC by Praveen
**Last Updated:** Tue Nov 25, 2014 08:44 AM UTC
**Owner:** Praveen

 
ava_mds_flat_dec() function use the calloc() to allocate memory for msg.
Memory is freed by this function in case error occurs. If no error
occurs then allocated memory will freed by the API which has made the 
synchronous call.

Steps to reproduce:
For reproducing the issue run amf demo app with valgrind. 
Perform unlock-in and lock-in operation.

valgrind report:
==11381==
==11381== 592 bytes in 1 blocks are definitely lost in loss record 51 of 56
==11381==    at 0x4A05140: calloc (vg_replace_malloc.c:418)
==11381==    by 0x4C2FEE1: ava_mds_flat_dec (ava_mds.c:533)
==11381==    by 0x4C2F69E: ava_mds_cbk (ava_mds.c:256)
==11381==    by 0x4E95E79: mds_mcm_do_decode_full_or_flat (mds_c_sndrcv.c:4944)
==11381==    by 0x4E9586B: mds_mcm_process_rcv_snd_rsp_common 
(mds_c_sndrcv.c:4705)
==11381==    by 0x4E95A60: mcm_recv_normal_snd_rsp (mds_c_sndrcv.c:4763)
==11381==    by 0x4E94BAC: mds_mcm_ll_data_rcv (mds_c_sndrcv.c:4124)
==11381==    by 0x4E8392B: mdtm_process_recv_message_common 
(mds_dt_common.c:483)
==11381==    by 0x4E845D2: mdtm_process_recv_data (mds_dt_common.c:900)
==11381==    by 0x4EA6334: mdtm_process_recv_events (mds_dt_tipc.c:701)
==11381==    by 0x39F020673C: start_thread (in /lib64/libpthread-2.5.so)
==11381==    by 0x39EF6D40CC: clone (in /lib64/libc-2.5.so)
==11381==
==11381== LEAK SUMMARY:
==11381==    definitely lost: 592 bytes in 1 blocks
==11381==    indirectly lost: 0 bytes in 0 blocks

Analysis:
saAmfResponse() API does not free the memory when response is sent for 
terminate callback.


Patch:
--- a/osaf/libs/agents/saf/amfa/ava_api.c
+++ b/osaf/libs/agents/saf/amfa/ava_api.c
@@ -1928,7 +1928,9 @@ SaAisErrorT saAmfResponse(SaAmfHandleT h
        if (hdl_rec)
                ncshm_give_hdl(hdl);

-       /* free the contents of the request message */
+       /* free the contents of the request/response message */
+       if (msg_rsp)
+               avsv_nda_ava_msg_free(msg_rsp);
        avsv_nda_ava_msg_content_free(&msg);

        TRACE_LEAVE2("rc:%u", rc);









---

Sent from sourceforge.net because [email protected] is 
subscribed to https://sourceforge.net/p/opensaf/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to