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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@368039 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2012-05-31 18:00:59 +00:00
parent f7d2d4601b
commit bd85d458a2
12 changed files with 134 additions and 131 deletions

View File

@@ -2492,11 +2492,11 @@ static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *
*/
if (!inserted && (qe->prio >= cur->prio) && position && (position <= pos + 1)) {
insert_entry(q, prev, qe, &pos);
inserted = 1;
/*pos is incremented inside insert_entry, so don't need to add 1 here*/
if (position < pos) {
ast_log(LOG_NOTICE, "Asked to be inserted at position %d but forced into position %d due to higher priority callers\n", position, pos);
}
inserted = 1;
}
cur->pos = ++pos;
prev = cur;
@@ -5992,6 +5992,8 @@ static int queue_exec(struct ast_channel *chan, const char *data)
set_queue_result(chan, reason);
return 0;
}
ast_assert(qe.parent != NULL);
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ENTERQUEUE", "%s|%s|%d",
S_OR(args.url, ""),
S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""),
@@ -6146,12 +6148,13 @@ stop:
if (reason != QUEUE_UNKNOWN)
set_queue_result(chan, reason);
if (qe.parent) {
/* every queue_ent is given a reference to it's parent call_queue when it joins the queue.
* This ref must be taken away right before the queue_ent is destroyed. In this case
* the queue_ent is about to be returned on the stack */
qe.parent = queue_unref(qe.parent);
}
/*
* every queue_ent is given a reference to it's parent
* call_queue when it joins the queue. This ref must be taken
* away right before the queue_ent is destroyed. In this case
* the queue_ent is about to be returned on the stack
*/
qe.parent = queue_unref(qe.parent);
return res;
}