]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Use upstreams refcounts
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 2 Jul 2022 12:35:22 +0000 (13:35 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 2 Jul 2022 12:35:22 +0000 (13:35 +0100)
src/lua/lua_http.c

index 5a05f7058e97ca0d2e876f2709e0f1e8fddfb61f..c4dffa8f7ae9eed3785173e44df1a7ad03fdfe05 100644 (file)
@@ -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);