[sr-dev] git:master:c836f8ba: rtpengine: allocate space for one more rtp relay control socket

Daniel-Constantin Mierla miconda at gmail.com
Mon May 13 15:29:50 CEST 2019


Module: kamailio
Branch: master
Commit: c836f8ba2f4d3a32b8a4fecba332355df01daca6
URL: https://github.com/kamailio/kamailio/commit/c836f8ba2f4d3a32b8a4fecba332355df01daca6

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-05-13T15:27:08+02:00

rtpengine: allocate space for one more rtp relay control socket

- keep it as safety end place holder
- should make it work again for the case when starting with no rtp
engine in the database - GH #1940

---

Modified: src/modules/rtpengine/rtpengine.c

---

Diff:  https://github.com/kamailio/kamailio/commit/c836f8ba2f4d3a32b8a4fecba332355df01daca6.diff
Patch: https://github.com/kamailio/kamailio/commit/c836f8ba2f4d3a32b8a4fecba332355df01daca6.patch

---

diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c
index 21f03775d6..40844ddb2e 100644
--- a/src/modules/rtpengine/rtpengine.c
+++ b/src/modules/rtpengine/rtpengine.c
@@ -1768,12 +1768,13 @@ static int build_rtpp_socks(int lmode, int rtest) {
 	}
 
 	rtpp_socks_size = current_rtpp_no;
-	rtpp_socks = (int*)pkg_reallocxf(rtpp_socks, sizeof(int)*(rtpp_socks_size));
+	/* allocate one more to have a safety end place holder */
+	rtpp_socks = (int*)pkg_reallocxf(rtpp_socks, sizeof(int)*(rtpp_socks_size+1));
 	if (!rtpp_socks) {
 		LM_ERR("no more pkg memory for rtpp_socks\n");
 		return -1;
 	}
-	memset(rtpp_socks, -1, sizeof(int)*(rtpp_socks_size));
+	memset(rtpp_socks, -1, sizeof(int)*(rtpp_socks_size+1));
 
 	rtpe_reload_lock_get(rtpp_set_list->rset_head_lock);
 	_rtpe_list_vernum_local = _rtpe_list_version->vernum;




More information about the sr-dev mailing list