]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Properly init and free session structures
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 7 May 2016 11:10:06 +0000 (12:10 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 7 May 2016 11:10:06 +0000 (12:10 +0100)
src/rspamd_proxy.c

index 8bbc664dc201599f0ea6d634795b5eb006e8bda2..b46bf410b019fabc319d3cee923e678f723bb0e4 100644 (file)
@@ -554,14 +554,16 @@ init_rspamd_proxy (struct rspamd_config *cfg)
 static void
 proxy_backend_close_connection (struct rspamd_proxy_backend_connection *conn)
 {
-       if (conn->backend_conn) {
-               rspamd_http_connection_reset (conn->backend_conn);
-               rspamd_http_connection_unref (conn->backend_conn);
-       }
+       if (conn) {
+               if (conn->backend_conn) {
+                       rspamd_http_connection_reset (conn->backend_conn);
+                       rspamd_http_connection_unref (conn->backend_conn);
+               }
 
-       close (conn->backend_sock);
+               close (conn->backend_sock);
 
-       conn->flags |= RSPAMD_BACKEND_CLOSED;
+               conn->flags |= RSPAMD_BACKEND_CLOSED;
+       }
 }
 
 static gboolean
@@ -1082,6 +1084,7 @@ proxy_accept_socket (gint fd, short what, void *arg)
        REF_INIT_RETAIN (session, proxy_session_dtor);
        session->client_sock = nfd;
        session->client_addr = addr;
+       session->mirror_conns = g_ptr_array_sized_new (ctx->mirrors->len);
 
        session->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "proxy");
        session->client_conn = rspamd_http_connection_new (