summaryrefslogtreecommitdiffstats
path: root/src/libutil/upstream.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-16 13:44:35 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-16 13:44:35 +0000
commit3256178a2433f242f69c55f6eaee36ea314b2f1a (patch)
tree69323a953a69d4d62c9c57e695c6f84ac9527bb8 /src/libutil/upstream.c
parent5c25ee027e883ea5251958ecee14ea5fc3e68946 (diff)
downloadrspamd-3256178a2433f242f69c55f6eaee36ea314b2f1a.tar.gz
rspamd-3256178a2433f242f69c55f6eaee36ea314b2f1a.zip
Fix couple of issues found by gcc-6
Diffstat (limited to 'src/libutil/upstream.c')
-rw-r--r--src/libutil/upstream.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c
index 574cf0667..8bbe48208 100644
--- a/src/libutil/upstream.c
+++ b/src/libutil/upstream.c
@@ -727,7 +727,7 @@ rspamd_upstream_get_round_robin (struct upstream_list *ups, gboolean use_cur)
}
}
- if (use_cur) {
+ if (use_cur && selected) {
if (selected->cur_weight > 0) {
selected->cur_weight--;
}
@@ -735,6 +735,7 @@ rspamd_upstream_get_round_robin (struct upstream_list *ups, gboolean use_cur)
selected->cur_weight = selected->weight;
}
}
+
rspamd_mutex_unlock (ups->lock);
return selected;