aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/upstream.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-09-13 14:49:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-09-13 14:49:25 +0100
commitd53f283c4e5d5ad64115d9e01d251a5f8c5f5679 (patch)
treefefb33620a84ed2c89001e1c916234a8a928fb71 /src/libutil/upstream.c
parente89fc350172a710d97eb301d8dfc9a9667610ed3 (diff)
downloadrspamd-d53f283c4e5d5ad64115d9e01d251a5f8c5f5679.tar.gz
rspamd-d53f283c4e5d5ad64115d9e01d251a5f8c5f5679.zip
[Minor] Add one more check for use-after-free prevention
Diffstat (limited to 'src/libutil/upstream.c')
-rw-r--r--src/libutil/upstream.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c
index 98e766194..8c194eb79 100644
--- a/src/libutil/upstream.c
+++ b/src/libutil/upstream.c
@@ -775,7 +775,7 @@ rspamd_upstream_fail (struct upstream *upstream,
upstream->name,
reason);
- if (upstream->ctx && upstream->active_idx != -1) {
+ if (upstream->ctx && upstream->active_idx != -1 && upstream->ls) {
sec_cur = rspamd_get_ticks (FALSE);
RSPAMD_UPSTREAM_LOCK (upstream);
@@ -885,7 +885,7 @@ rspamd_upstream_ok (struct upstream *upstream)
struct upstream_list_watcher *w;
RSPAMD_UPSTREAM_LOCK (upstream);
- if (upstream->errors > 0 && upstream->active_idx != -1) {
+ if (upstream->errors > 0 && upstream->active_idx != -1 && upstream->ls) {
/* We touch upstream if and only if it is active */
msg_debug_upstream ("reset errors on upstream %s (was %ud)", upstream->name, upstream->errors);
upstream->errors = 0;