summaryrefslogtreecommitdiff
path: root/channels/chan_iax2.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-05-31 18:39:30 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-05-31 18:39:30 +0000
commitdd2427c1414d62cd7e3c867f17de9d6dbac844fe (patch)
tree5760fb673e236d0f58b094240de81ca9780cd135 /channels/chan_iax2.c
parentfdb002a43a819542693815767a0ca9aba135f18c (diff)
Coverity Report: Fix issues for error type REVERSE_INULL (core modules)
* Fixes findings: 0-2,5,7-15,24-26,28-31 (issue ASTERISK-19648) Reported by: Matt Jordan ........ Merged revisions 368039 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 368042 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r--channels/chan_iax2.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index a50289b21..ade8438bd 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -2433,19 +2433,20 @@ static void peercnt_remove(struct peercnt *peercnt)
.sin_addr.s_addr = peercnt->addr,
};
- if (peercnt) {
- /* Container locked here since peercnt may be unlinked from list. If left unlocked,
- * peercnt_add could try and grab this entry from the table and modify it at the
- * "same time" this thread attemps to unlink it.*/
- ao2_lock(peercnts);
- peercnt->cur--;
- ast_debug(1, "ip callno count decremented to %d for %s\n", peercnt->cur, ast_inet_ntoa(sin.sin_addr));
- /* if this was the last connection from the peer remove it from table */
- if (peercnt->cur == 0) {
- ao2_unlink(peercnts, peercnt);/* decrements ref from table, last ref is left to scheduler */
- }
- ao2_unlock(peercnts);
+ /*
+ * Container locked here since peercnt may be unlinked from
+ * list. If left unlocked, peercnt_add could try and grab this
+ * entry from the table and modify it at the "same time" this
+ * thread attemps to unlink it.
+ */
+ ao2_lock(peercnts);
+ peercnt->cur--;
+ ast_debug(1, "ip callno count decremented to %d for %s\n", peercnt->cur, ast_inet_ntoa(sin.sin_addr));
+ /* if this was the last connection from the peer remove it from table */
+ if (peercnt->cur == 0) {
+ ao2_unlink(peercnts, peercnt);/* decrements ref from table, last ref is left to scheduler */
}
+ ao2_unlock(peercnts);
}
/*!
@@ -5928,16 +5929,15 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str
The "genuine" distinction is needed because genuine frames must get a clock-based timestamp,
the others need a timestamp slaved to the voice frames so that they go in sequence
*/
- if (f) {
- if (f->frametype == AST_FRAME_VOICE) {
- voice = 1;
- delivery = &f->delivery;
- } else if (f->frametype == AST_FRAME_IAX) {
- genuine = 1;
- } else if (f->frametype == AST_FRAME_CNG) {
- p->notsilenttx = 0;
- }
+ if (f->frametype == AST_FRAME_VOICE) {
+ voice = 1;
+ delivery = &f->delivery;
+ } else if (f->frametype == AST_FRAME_IAX) {
+ genuine = 1;
+ } else if (f->frametype == AST_FRAME_CNG) {
+ p->notsilenttx = 0;
}
+
if (ast_tvzero(p->offset)) {
p->offset = ast_tvnow();
/* Round to nearest 20ms for nice looking traces */