瀏覽代碼

[Minor] Add one more check for use-after-free prevention

tags/3.1
Vsevolod Stakhov 2 年之前
父節點
當前提交
d53f283c4e
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. 2
    2
      src/libutil/upstream.c

+ 2
- 2
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;

Loading…
取消
儲存