commit d6f8ba8: [Minor] Use upstreams refcounts

Vsevolod Stakhov vsevolod at rspamd.com
Sat Jul 2 12:49:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-07-02 13:35:22 +0100
URL: https://github.com/rspamd/rspamd/commit/d6f8ba8d1efd06158ed9d9a678528e4be6690b2e

[Minor] Use upstreams refcounts

---
 src/lua/lua_http.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c
index 5a05f7058..c4dffa8f7 100644
--- a/src/lua/lua_http.c
+++ b/src/lua/lua_http.c
@@ -128,6 +128,10 @@ lua_http_fin (gpointer arg)
 		rspamd_inet_address_free (cbd->addr);
 	}
 
+	if (cbd->up) {
+		rspamd_upstream_unref(cbd->up);
+	}
+
 	if (cbd->mime_type) {
 		g_free (cbd->mime_type);
 	}
@@ -1058,7 +1062,7 @@ lua_http_request (lua_State *L)
 	cbd->url = url;
 	cbd->auth = auth;
 	cbd->task = task;
-	cbd->up = up;
+	cbd->up = rspamd_upstream_ref(up);
 
 	if (cbd->cbref == -1) {
 		cbd->thread = lua_thread_pool_get_running_entry (cfg->lua_thread_pool);


More information about the Commits mailing list