From: Vsevolod Stakhov Date: Wed, 5 Jul 2017 07:14:59 +0000 (+0100) Subject: [Fix] Plug memory leak X-Git-Tag: 1.6.2~27 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fdb3dc56bb52bc6823fdd40914a03e5f60d60f9e;p=rspamd.git [Fix] Plug memory leak Issue: #1697 --- 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;