From a3ce6d43de5afb2b387e2a07cedab9004c4a0cb5 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 14 Oct 2017 18:08:24 +0100 Subject: [PATCH] [Fix] Plug memory leak in lua_tcp --- src/lua/lua_tcp.c | 10 ++++------ src/plugins/spf.c | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index 1f7b2b05b..6e47e98a0 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -333,12 +333,7 @@ lua_tcp_push_error (struct lua_tcp_cbdata *cbd, gboolean is_fatal, va_start (ap, err); for (;;) { - if (is_fatal) { - hdl = g_queue_pop_head (cbd->handlers); - } - else { - hdl = g_queue_peek_head (cbd->handlers); - } + hdl = g_queue_peek_head (cbd->handlers); if (hdl == NULL) { va_end (ap_copy); @@ -380,6 +375,9 @@ lua_tcp_push_error (struct lua_tcp_cbdata *cbd, gboolean is_fatal, /* Stop on the first callback found */ break; } + else { + lua_tcp_shift_handler (cbd); + } } va_end (ap); diff --git a/src/plugins/spf.c b/src/plugins/spf.c index 097df7329..41e952eb2 100644 --- a/src/plugins/spf.c +++ b/src/plugins/spf.c @@ -539,6 +539,7 @@ spf_plugin_callback (struct spf_resolved *record, struct rspamd_task *task, } } + spf_record_ref (l); spf_check_list (l, task); spf_record_unref (l); -- 2.39.5