[sofia-sip] scan-build: Fix "Dereference of null pointer" in outgoing_answer_srv().
This commit is contained in:
parent
ee89cc8aa5
commit
3a3f7957aa
|
@ -1 +1 @@
|
||||||
Thu Feb 20 11:10:22 UTC 2020
|
Thu Feb 20 12:12:22 UTC 2020
|
||||||
|
|
|
@ -10694,13 +10694,14 @@ outgoing_answer_srv(sres_context_t *orq, sres_query_t *q,
|
||||||
if (N > 1 && weight > 0) {
|
if (N > 1 && weight > 0) {
|
||||||
unsigned rand = su_randint(0, weight - 1);
|
unsigned rand = su_randint(0, weight - 1);
|
||||||
|
|
||||||
while (rand >= (*tail)->sq_weight) {
|
while (*tail && rand >= (*tail)->sq_weight) {
|
||||||
rand -= (*tail)->sq_weight;
|
rand -= (*tail)->sq_weight;
|
||||||
tail = &(*tail)->sq_next;
|
tail = &(*tail)->sq_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove selected */
|
/* Remove selected */
|
||||||
|
if (*tail) {
|
||||||
sq = *tail; *tail = sq->sq_next; assert(sq->sq_priority == priority);
|
sq = *tail; *tail = sq->sq_next; assert(sq->sq_priority == priority);
|
||||||
|
|
||||||
/* Append at *at */
|
/* 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,
|
(unsigned)sq->sq_priority, (unsigned)sq->sq_weight,
|
||||||
sq->sq_port, sq->sq_domain, sq->sq_proto));
|
sq->sq_port, sq->sq_domain, sq->sq_proto));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* This is not needed anymore (?) */
|
/* This is not needed anymore (?) */
|
||||||
sr->sr_current = NULL;
|
sr->sr_current = NULL;
|
||||||
|
|
Loading…
Reference in New Issue