[sr-dev] git:5.2:1f4262b3: rtpengine: allocate space for one more rtp relay control socket

Daniel-Constantin Mierla miconda at gmail.com
Thu May 16 21:11:29 CEST 2019


Module: kamailio
Branch: 5.2
Commit: 1f4262b3f7db30e917eec36132c193c4be6c04c1
URL: https://github.com/kamailio/kamailio/commit/1f4262b3f7db30e917eec36132c193c4be6c04c1

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-05-16T21:08:25+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

(cherry picked from commit c836f8ba2f4d3a32b8a4fecba332355df01daca6)

---

Modified: src/modules/rtpengine/rtpengine.c

---

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

---

diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c
index 484ce05f35..650ee9424b 100644
--- a/src/modules/rtpengine/rtpengine.c
+++ b/src/modules/rtpengine/rtpengine.c
@@ -1717,12 +1717,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