From 77ec19e25506d02936a63600b7a4a8a70f7aa405 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Fri, 7 Dec 2007 00:58:52 +0000 Subject: [PATCH] Merged revisions 91637 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r91637 | tilghman | 2007-12-06 18:52:17 -0600 (Thu, 06 Dec 2007) | 5 lines At the end of a call, when we're reporting, RTCP may already be partially torn down, so check for NULL dereference Reported by: blitzrage Patch by: tilghman (Closes issue #11450) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91638 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/rtp.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/main/rtp.c b/main/rtp.c index 97bbe59fcf..4bc9842f79 100644 --- a/main/rtp.c +++ b/main/rtp.c @@ -2389,20 +2389,34 @@ char *ast_rtp_get_quality(struct ast_rtp *rtp, struct ast_rtp_quality *qual) *rtt round trip time */ - if (qual) { + if (qual && rtp) { qual->local_ssrc = rtp->ssrc; - qual->local_lostpackets = rtp->rtcp->expected_prior - rtp->rtcp->received_prior; qual->local_jitter = rtp->rxjitter; qual->local_count = rtp->rxcount; qual->remote_ssrc = rtp->themssrc; - qual->remote_lostpackets = rtp->rtcp->reported_lost; - qual->remote_jitter = rtp->rtcp->reported_jitter / 65536.0; qual->remote_count = rtp->txcount; - qual->rtt = rtp->rtcp->rtt; + if (rtp->rtcp) { + qual->local_lostpackets = rtp->rtcp->expected_prior - rtp->rtcp->received_prior; + qual->remote_lostpackets = rtp->rtcp->reported_lost; + qual->remote_jitter = rtp->rtcp->reported_jitter / 65536.0; + qual->rtt = rtp->rtcp->rtt; + } } - snprintf(rtp->rtcp->quality, sizeof(rtp->rtcp->quality), "ssrc=%u;themssrc=%u;lp=%u;rxjitter=%f;rxcount=%u;txjitter=%f;txcount=%u;rlp=%u;rtt=%f", rtp->ssrc, rtp->themssrc, rtp->rtcp->expected_prior - rtp->rtcp->received_prior, rtp->rxjitter, rtp->rxcount, (double)rtp->rtcp->reported_jitter/65536., rtp->txcount, rtp->rtcp->reported_lost, rtp->rtcp->rtt); - - return rtp->rtcp->quality; + if (rtp->rtcp) { + snprintf(rtp->rtcp->quality, sizeof(rtp->rtcp->quality), + "ssrc=%u;themssrc=%u;lp=%u;rxjitter=%f;rxcount=%u;txjitter=%f;txcount=%u;rlp=%u;rtt=%f", + rtp->ssrc, + rtp->themssrc, + rtp->rtcp->expected_prior - rtp->rtcp->received_prior, + rtp->rxjitter, + rtp->rxcount, + (double)rtp->rtcp->reported_jitter / 65536.0, + rtp->txcount, + rtp->rtcp->reported_lost, + rtp->rtcp->rtt); + return rtp->rtcp->quality; + } else + return " - RTP/RTCP has already been destroyed"; } void ast_rtp_destroy(struct ast_rtp *rtp)