summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--channels/chan_pjsip.c9
-rw-r--r--channels/chan_sip.c3
-rw-r--r--main/cdr.c2
-rw-r--r--tests/test_netsock2.c6
4 files changed, 15 insertions, 5 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 370075d2b..22f834d37 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -269,6 +269,9 @@ static int direct_media_mitigate_glare(struct ast_sip_session *session)
return 0;
}
+/*!
+ * \pre chan is locked
+ */
static int check_for_rtp_changes(struct ast_channel *chan, struct ast_rtp_instance *rtp,
struct ast_sip_session_media *media, int rtcp_fd)
{
@@ -338,6 +341,11 @@ static int send_direct_media_request(void *data)
int changed = 0;
int res = 0;
+ /* The channel needs to be locked when checking for RTP changes.
+ * Otherwise, we could end up destroying an underlying RTCP structure
+ * at the same time that the channel thread is attempting to read RTCP
+ */
+ ast_channel_lock(cdata->chan);
if (pvt->media[SIP_MEDIA_AUDIO]) {
changed |= check_for_rtp_changes(
cdata->chan, cdata->rtp, pvt->media[SIP_MEDIA_AUDIO], 1);
@@ -346,6 +354,7 @@ static int send_direct_media_request(void *data)
changed |= check_for_rtp_changes(
cdata->chan, cdata->vrtp, pvt->media[SIP_MEDIA_VIDEO], 3);
}
+ ast_channel_unlock(cdata->chan);
if (direct_media_mitigate_glare(cdata->session)) {
ast_debug(4, "Disregarding setting RTP on %s: mitigating re-INVITE glare\n", ast_channel_name(cdata->chan));
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index eec904f57..4c3516d8c 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -15790,11 +15790,12 @@ static void start_register_timeout(struct sip_registry *reg)
static const char *sip_sanitized_host(const char *host)
{
- struct ast_sockaddr addr = { { 0, 0, }, };
+ struct ast_sockaddr addr;
/* peer/sip_pvt->tohost and sip_registry->hostname should never have a port
* in them, so we use PARSE_PORT_FORBID here. If this lookup fails, we return
* the original host which is most likely a host name and not an IP. */
+ memset(&addr, 0, sizeof(addr));
if (!ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID)) {
return host;
}
diff --git a/main/cdr.c b/main/cdr.c
index b43e3610c..8658710d5 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -1415,8 +1415,6 @@ static int base_process_bridge_leave(struct cdr_object *cdr, struct ast_bridge_s
static int base_process_dial_end(struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer, const char *dial_status)
{
- /* In general, most things shouldn't get a dial end. */
- ast_assert(0);
return 0;
}
diff --git a/tests/test_netsock2.c b/tests/test_netsock2.c
index 638ff37cc..780b0b06f 100644
--- a/tests/test_netsock2.c
+++ b/tests/test_netsock2.c
@@ -75,7 +75,7 @@ AST_TEST_DEFINE(parsing)
};
size_t x;
- struct ast_sockaddr addr = { { 0, 0, } };
+ struct ast_sockaddr addr;
int parse_result;
switch (cmd) {
@@ -91,15 +91,17 @@ AST_TEST_DEFINE(parsing)
}
for (x = 0; x < ARRAY_LEN(test_vals); x++) {
+ memset(&addr, 0, sizeof(addr));
if ((parse_result = ast_sockaddr_parse(&addr, test_vals[x].address, 0)) != test_vals[x].expected_result) {
ast_test_status_update(test, "On '%s' expected %d but got %d\n", test_vals[x].address, test_vals[x].expected_result, parse_result);
res = AST_TEST_FAIL;
}
if (parse_result) {
- struct ast_sockaddr tmp_addr = { { 0, 0, } };
+ struct ast_sockaddr tmp_addr;
const char *tmp;
tmp = ast_sockaddr_stringify(&addr);
+ memset(&tmp_addr, 0, sizeof(tmp_addr));
ast_sockaddr_parse(&tmp_addr, tmp, 0);
if (ast_sockaddr_cmp_addr(&addr, &tmp_addr)) {
char buf[64];