aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-18 19:53:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-18 19:53:25 +0100
commit3c9316a2b7ab6c94764e492caad23b1a0ec5795c (patch)
tree324907179d97b43b573961be9f26279edcb1a3af /src/libserver
parentfb7491db290eaee03e8e38266eb0d6fefb9d22ed (diff)
downloadrspamd-3c9316a2b7ab6c94764e492caad23b1a0ec5795c.tar.gz
rspamd-3c9316a2b7ab6c94764e492caad23b1a0ec5795c.zip
[Fix] Fix crashes in the rspamd_control path
Issue: #1757
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/rspamd_control.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/libserver/rspamd_control.c b/src/libserver/rspamd_control.c
index ab2f736b6..6e3553873 100644
--- a/src/libserver/rspamd_control.c
+++ b/src/libserver/rspamd_control.c
@@ -768,15 +768,9 @@ rspamd_control_handle_on_fork (struct rspamd_srv_command *cmd,
}
}
-struct rspamd_srv_cbdata {
- struct rspamd_worker *worker;
- struct rspamd_main *srv;
-};
-
static void
rspamd_srv_handler (gint fd, short what, gpointer ud)
{
- struct rspamd_srv_cbdata *cbd;
struct rspamd_worker *worker;
static struct rspamd_srv_command cmd;
struct rspamd_main *srv;
@@ -791,9 +785,8 @@ rspamd_srv_handler (gint fd, short what, gpointer ud)
gssize r;
if (what == EV_READ) {
- cbd = ud;
- worker = cbd->worker;
- srv = cbd->srv;
+ worker = ud;
+ srv = worker->srv;
iov.iov_base = &cmd;
iov.iov_len = sizeof (cmd);
memset (&msg, 0, sizeof (msg));
@@ -959,14 +952,10 @@ rspamd_srv_start_watching (struct rspamd_main *srv,
struct rspamd_worker *worker,
struct event_base *ev_base)
{
- struct rspamd_srv_cbdata *cbd;
g_assert (worker != NULL);
- cbd = rspamd_mempool_alloc (srv->server_pool, sizeof (*cbd));
- cbd->worker = worker;
- cbd->srv = srv;
event_set (&worker->srv_ev, worker->srv_pipe[0], EV_READ | EV_PERSIST,
- rspamd_srv_handler, cbd);
+ rspamd_srv_handler, worker);
event_base_set (ev_base, &worker->srv_ev);
event_add (&worker->srv_ev, NULL);
}