[sofia-sip] scan-build: Fix "Dereference of null pointer" in outgoing_answer_srv().

This commit is contained in:
Andrey Volk 2020-02-20 22:24:42 +04:00
parent ee89cc8aa5
commit 3a3f7957aa
2 changed files with 11 additions and 9 deletions

View File

@ -1 +1 @@
Thu Feb 20 11:10:22 UTC 2020
Thu Feb 20 12:12:22 UTC 2020

View File

@ -10694,13 +10694,14 @@ outgoing_answer_srv(sres_context_t *orq, sres_query_t *q,
if (N > 1 && weight > 0) {
unsigned rand = su_randint(0, weight - 1);
while (rand >= (*tail)->sq_weight) {
while (*tail && rand >= (*tail)->sq_weight) {
rand -= (*tail)->sq_weight;
tail = &(*tail)->sq_next;
}
}
/* Remove selected */
if (*tail) {
sq = *tail; *tail = sq->sq_next; assert(sq->sq_priority == priority);
/* Append at *at */
@ -10711,6 +10712,7 @@ outgoing_answer_srv(sres_context_t *orq, sres_query_t *q,
(unsigned)sq->sq_priority, (unsigned)sq->sq_weight,
sq->sq_port, sq->sq_domain, sq->sq_proto));
}
}
/* This is not needed anymore (?) */
sr->sr_current = NULL;