diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-05-07 12:10:06 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-05-07 12:10:06 +0100 |
commit | fae5e1ba7f95bee14efd914a8be56cb1609df90a (patch) | |
tree | 2e5e228f4a551e8a3ae2eafb2380f5e32111ab6e /src/rspamd_proxy.c | |
parent | b295a4be34f1581b84d8f17f44c41a114dc91493 (diff) | |
download | rspamd-fae5e1ba7f95bee14efd914a8be56cb1609df90a.tar.gz rspamd-fae5e1ba7f95bee14efd914a8be56cb1609df90a.zip |
[Fix] Properly init and free session structures
Diffstat (limited to 'src/rspamd_proxy.c')
-rw-r--r-- | src/rspamd_proxy.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c index 8bbc664dc..b46bf410b 100644 --- a/src/rspamd_proxy.c +++ b/src/rspamd_proxy.c @@ -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 ( |