summaryrefslogtreecommitdiff
path: root/source4/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-04-03 18:04:31 +0000
committerJeremy Allison <jra@samba.org>2017-04-17 19:13:07 +0200
commitf24ecb035b8719c961e1e4ad7c4948f1dbd5165b (patch)
tree7c542c2a193fda19dc0c031e9923aab2139c9fce /source4/smbd
parentfc8f858c8cdac4a50517e48d4f5af6273c27b894 (diff)
downloadsamba-f24ecb035b8719c961e1e4ad7c4948f1dbd5165b.tar.gz
s4: server: Remove use of talloc_autofree_context as the parent of event_ctx.
Use state->event_ctx as the parent of the initial imessaging context. Now we control all exit paths, we can call TALLOC_FREE(state) on all of them. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source4/smbd')
-rw-r--r--source4/smbd/server.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index ec56d1025ea..22b22a79fd9 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -137,6 +137,7 @@ static void sigterm_signal_handler(struct tevent_context *ev,
private_data, struct server_state);
DEBUG(10,("Process %s got SIGTERM\n", state->binary_name));
+ TALLOC_FREE(state);
sig_term(SIGTERM);
}
@@ -192,6 +193,7 @@ static void server_stdin_handler(struct tevent_context *event_ctx,
kill(-getpgrp(), SIGTERM);
}
#endif
+ TALLOC_FREE(state);
exit(0);
}
}
@@ -211,6 +213,7 @@ _NORETURN_ static void max_runtime_handler(struct tevent_context *ev,
(int)getpid(),
(unsigned long long)t.tv_sec,
(unsigned long long)time(NULL)));
+ TALLOC_FREE(state);
exit(0);
}
@@ -245,6 +248,7 @@ static NTSTATUS samba_terminate(struct irpc_message *msg,
struct server_state);
DBG_ERR("samba_terminate of %s %d: %s\n",
state->binary_name, (int)getpid(), r->in.reason);
+ TALLOC_FREE(state);
exit(1);
}
@@ -257,7 +261,7 @@ static NTSTATUS setup_parent_messaging(struct server_state *state,
struct imessaging_context *msg;
NTSTATUS status;
- msg = imessaging_init(talloc_autofree_context(),
+ msg = imessaging_init(state->event_ctx,
lp_ctx,
cluster_id(0, SAMBA_PARENT_TASKID),
state->event_ctx);
@@ -485,7 +489,7 @@ static int binary_smbd_main(const char *binary_name,
/* the event context is the top level structure in smbd. Everything else
should hang off that */
- state->event_ctx = s4_event_context_init(talloc_autofree_context());
+ state->event_ctx = s4_event_context_init(state);
if (state->event_ctx == NULL) {
exit_daemon("Initializing event context failed", EACCES);