[sr-dev] Possible memory leak when several modules use SREV_NET_DATA_IN/SREV_NET_DATA_OUT callbacks.

Vitaliy Aleksandrov vitalik.voip at gmail.com
Mon Aug 8 16:31:14 CEST 2016


Hi kamailio developers,

While I was working on a custom encryption module based on the
corex network_io_intercept feature, I found a possible memory leak.

Several modules like corex, gzcompress and topoh SREV_NET_DATA_OUT to catch
an outgoing message just before sending it out. Those modules receive a
buffer with a sip message and in the end of all their trunsformations use
*build_req_buf_from_sip_req* to build a new buffer. *build_req_buf_from_sip_req
*allocated pkg memory for its result and kamailio core clears that buffer
after sending it out (forward.h:msg_send_buffer:286). As far as I
understood, when we have more than one callback in chain, they override pkg
allocated buffer and kamailio core frees only the last one (allocated by
the last callback) creating a leek.

Will be happy to be wrong, but can't find how those memory chunks are freed.

Best regargs,
Vitaliy Aleksandrov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20160808/fe8c853d/attachment.html>


More information about the sr-dev mailing list