[asterisk-commits] file: trunk r38573 - /trunk/rtp.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Jul 31 08:24:05 MST 2006
Author: file
Date: Mon Jul 31 10:24:05 2006
New Revision: 38573
URL: http://svn.digium.com/view/asterisk?rev=38573&view=rev
Log:
Poking at a structure when it may not even be allocated is not healthy. Essentially make sure an RTCP structure exists before trying to delete it's scheduled item. (issue #7514 reported by jmls fixed by AuPix)
Modified:
trunk/rtp.c
Modified: trunk/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/rtp.c?rev=38573&r1=38572&r2=38573&view=diff
==============================================================================
--- trunk/rtp.c (original)
+++ trunk/rtp.c Mon Jul 31 10:24:05 2006
@@ -1041,7 +1041,7 @@
rtp->seedrxseqno = seqno;
}
- if (rtp->rtcp->schedid < 1) {
+ if (rtp->rtcp && rtp->rtcp->schedid < 1) {
/* Schedule transmission of Receiver Report */
rtp->rtcp->schedid = ast_sched_add(rtp->sched, ast_rtcp_calc_interval(rtp), ast_rtcp_write, rtp);
}
@@ -1755,7 +1755,7 @@
void ast_rtp_stop(struct ast_rtp *rtp)
{
- if (rtp->rtcp->schedid > 0) {
+ if (rtp->rtcp && rtp->rtcp->schedid > 0) {
ast_sched_del(rtp->sched, rtp->rtcp->schedid);
rtp->rtcp->schedid = -1;
}
@@ -1827,11 +1827,6 @@
ast_verbose(" RTT: %f\n", rtp->rtcp->rtt);
}
- if (rtp->rtcp->schedid > 0) {
- ast_sched_del(rtp->sched, rtp->rtcp->schedid);
- rtp->rtcp->schedid = -1;
- }
-
if (rtp->smoother)
ast_smoother_free(rtp->smoother);
if (rtp->ioid)
@@ -1839,6 +1834,8 @@
if (rtp->s > -1)
close(rtp->s);
if (rtp->rtcp) {
+ if (rtp->rtcp->schedid > 0)
+ ast_sched_del(rtp->sched, rtp->rtcp->schedid);
close(rtp->rtcp->s);
free(rtp->rtcp);
rtp->rtcp=NULL;
@@ -2294,7 +2291,7 @@
rtp->txcount++;
rtp->txoctetcount +=(res - hdrlen);
- if (rtp->rtcp->schedid < 1)
+ if (rtp->rtcp && rtp->rtcp->schedid < 1)
rtp->rtcp->schedid = ast_sched_add(rtp->sched, ast_rtcp_calc_interval(rtp), ast_rtcp_write, rtp);
}
More information about the asterisk-commits
mailing list