]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Plug memory leak
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 5 Jul 2017 07:14:59 +0000 (08:14 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 5 Jul 2017 07:14:59 +0000 (08:14 +0100)
Issue: #1697

src/libserver/milter.c
src/rspamd_proxy.c

index c547f7ea96a81745f2cbcaaacffad1c9c30015c3..dad7c5afaca273d406068af601e343455f4f0948 100644 (file)
@@ -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);
index 81ef2a8aa2d1979db87f20adb6c6c6fe362ab17a..1c03345907c60b57c382f65935b55dbebd3abfeb 100644 (file)
@@ -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;