aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-05 08:14:59 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-05 08:14:59 +0100
commitfdb3dc56bb52bc6823fdd40914a03e5f60d60f9e (patch)
treed6cde010bafedb21a356a6482ea17cb2225dadc9
parenta0a5b90f06b915ac5a123ecf219a688e2ce0df49 (diff)
downloadrspamd-fdb3dc56bb52bc6823fdd40914a03e5f60d60f9e.tar.gz
rspamd-fdb3dc56bb52bc6823fdd40914a03e5f60d60f9e.zip
[Fix] Plug memory leak
Issue: #1697
-rw-r--r--src/libserver/milter.c3
-rw-r--r--src/rspamd_proxy.c4
2 files changed, 4 insertions, 3 deletions
diff --git a/src/libserver/milter.c b/src/libserver/milter.c
index c547f7ea9..dad7c5afa 100644
--- a/src/libserver/milter.c
+++ b/src/libserver/milter.c
@@ -163,6 +163,7 @@ rspamd_milter_session_dtor (struct rspamd_milter_session *session)
if (session) {
priv = session->priv;
+ msg_debug_milter ("destroying milter session");
if (event_get_base (&priv->ev)) {
event_del (&priv->ev);
@@ -635,7 +636,7 @@ rspamd_milter_process_command (struct rspamd_milter_session *session,
version, actions, protocol);
break;
case RSPAMD_MILTER_CMD_QUIT:
- msg_debug_milter ("quit command");
+ msg_debug_milter ("quit command, refcount: %d", session->ref.refcount);
priv->state = RSPAMD_MILTER_WANNA_DIE;
REF_RETAIN (session);
priv->fin_cb (priv->fd, session, priv->ud);
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index 81ef2a8aa..1c0334590 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -1893,6 +1893,8 @@ proxy_milter_finish_handler (gint fd,
struct rspamd_proxy_session *session = ud;
struct rspamd_http_message *msg;
+ session->client_milter_conn = rms;
+
if (rms->message == NULL || rms->message->len == 0) {
msg_info_session ("finished milter connection");
proxy_backend_close_connection (session->master_conn);
@@ -1904,9 +1906,7 @@ proxy_milter_finish_handler (gint fd,
sizeof (*session->master_conn));
}
- session->client_milter_conn = rms;
msg = rspamd_milter_to_http (rms);
-
session->master_conn->s = session;
session->master_conn->name = "master";
session->client_message = msg;