commit fdb077d: [Minor] Add special assertions to avoid upstreams corruption

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Aug 29 12:14:06 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-08-29 13:07:47 +0100
URL: https://github.com/rspamd/rspamd/commit/fdb077d507c91d60dbcbdadd206cfe6495cef4c1 (HEAD -> master)

[Minor] Add special assertions to avoid upstreams corruption

---
 src/libutil/upstream.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c
index 177731038..0637a0ac1 100644
--- a/src/libutil/upstream.c
+++ b/src/libutil/upstream.c
@@ -450,6 +450,7 @@ rspamd_upstream_revive_cb (struct ev_loop *loop, ev_timer *w, int revents)
 	}
 
 	RSPAMD_UPSTREAM_UNLOCK (upstream->lock);
+	g_assert (upstream->ref.refcount > 1);
 	REF_RELEASE (upstream);
 }
 
@@ -1045,6 +1046,7 @@ rspamd_upstream_restore_cb (gpointer elt, gpointer ls)
 	}
 
 	/* For revive event */
+	g_assert (up->ref.refcount > 1);
 	REF_RELEASE (up);
 }
 


More information about the Commits mailing list