[sr-dev] [kamailio/kamailio] msrp: fix some tcpconn where memory was never cleaned up (PR #2890)

Daniel-Constantin Mierla notifications at github.com
Thu Oct 21 11:43:02 CEST 2021

@miconda commented on this pull request.

> @@ -169,12 +169,16 @@ int msrp_relay(msrp_frame_t *mf)
 			wsev.len = p - reqbuf;
 			wsev.id = con->id;
 			evp.data = (void *)&wsev;
+			tcpconn_put(con);
 			return sr_event_exec(SREV_TCP_WS_FRAME_OUT, &evp);

I think the code has to be changed to do the `tcpconn_put(con)` after `sr_event_exec(SREV_TCP_WS_FRAME_OUT, &evp);`. Declare `int ret;` at the beginning of the function and then:

			ret = sr_event_exec(SREV_TCP_WS_FRAME_OUT, &evp);
			return ret;

I haven't read the code thoroughly, but I expect that if the connection is released before event execution, then it is a risk that the connection is destroyed while executing the event callbacks.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20211021/2ef12fe5/attachment.htm>

More information about the sr-dev mailing list