Revert "mgcp_ratectr: add stats items to monitor trunk usage"
This reverts commit 6bad138c96ef0e2a93ef7de42e897880131c0b43.
Reason for revert: heap-use-after-free during 'make check'
in mgcp_test.c test_retransmission()
Change-Id: I96792a719c9c7273676ab9ffe0b9e2aae4c23166
Related: OS#5201
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 26fcc2a..bcbcc02 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -1065,20 +1065,20 @@
int i;
struct mgcp_endpoint endp;
struct mgcp_endpoint *endpoints[1];
- struct mgcp_config *cfg;
- struct mgcp_trunk *trunk;
+ struct mgcp_config cfg = {0};
+ struct mgcp_trunk trunk;
printf("Testing packet loss calculation.\n");
memset(&endp, 0, sizeof(endp));
- cfg = mgcp_config_alloc();
- trunk = mgcp_trunk_alloc(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
- endp.cfg = cfg;
+ memset(&trunk, 0, sizeof(trunk));
+
+ endp.cfg = &cfg;
endp.type = &ep_typeset.rtp;
- trunk->v.vty_number_endpoints = 1;
- trunk->endpoints = endpoints;
- trunk->endpoints[0] = &endp;
- endp.trunk = trunk;
+ trunk.v.vty_number_endpoints = 1;
+ trunk.endpoints = endpoints;
+ trunk.endpoints[0] = &endp;
+ endp.trunk = &trunk;
INIT_LLIST_HEAD(&endp.conns);
for (i = 0; i < ARRAY_SIZE(pl_test_dat); ++i) {
@@ -1116,8 +1116,6 @@
mgcp_conn_free_all(&endp);
}
- talloc_free(trunk);
- talloc_free(cfg);
}
int mgcp_parse_stats(struct msgb *msg, uint32_t *ps, uint32_t *os,
@@ -1299,10 +1297,10 @@
{
int i;
- struct mgcp_trunk *trunk;
+ struct mgcp_trunk trunk;
struct mgcp_endpoint endp;
struct mgcp_endpoint *endpoints[1];
- struct mgcp_config *cfg;
+ struct mgcp_config cfg = {0};
struct mgcp_rtp_state state;
struct mgcp_rtp_end *rtp;
struct osmo_sockaddr addr = { 0 };
@@ -1320,8 +1318,7 @@
patch_ssrc ? ", patch SSRC" : "",
patch_ts ? ", patch timestamps" : "");
- cfg = mgcp_config_alloc();
- trunk = mgcp_trunk_alloc(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
+ memset(&trunk, 0, sizeof(trunk));
memset(&endp, 0, sizeof(endp));
memset(&state, 0, sizeof(state));
@@ -1330,16 +1327,16 @@
state.in_stream.err_ts_ctr = &test_ctr_in;
state.out_stream.err_ts_ctr = &test_ctr_out;
- endp.cfg = cfg;
+ endp.cfg = &cfg;
endp.type = &ep_typeset.rtp;
- trunk->v.vty_number_endpoints = 1;
- trunk->endpoints = endpoints;
- trunk->endpoints[0] = &endp;
- trunk->force_constant_ssrc = patch_ssrc;
- trunk->force_aligned_timing = patch_ts;
+ trunk.v.vty_number_endpoints = 1;
+ trunk.endpoints = endpoints;
+ trunk.endpoints[0] = &endp;
+ trunk.force_constant_ssrc = patch_ssrc;
+ trunk.force_aligned_timing = patch_ts;
- endp.trunk = trunk;
+ endp.trunk = &trunk;
INIT_LLIST_HEAD(&endp.conns);
_conn = mgcp_conn_alloc(NULL, &endp, MGCP_CONN_TYPE_RTP,
@@ -1398,8 +1395,6 @@
force_monotonic_time_us = -1;
mgcp_conn_free_all(&endp);
- talloc_free(trunk);
- talloc_free(cfg);
}
static void test_multilple_codec(void)