struct messaging_context *smbd_messaging_context(void)
{
if (smbd_msg_ctx == NULL) {
- smbd_msg_ctx = messaging_init(talloc_autofree_context(),
+ /*
+ * Note we MUST use the NULL context here, not the
+ * autofree context, to avoid side effects in forked
+ * children exiting.
+ */
+ smbd_msg_ctx = messaging_init(NULL,
procid_self(),
smbd_event_context());
}
struct memcache *smbd_memcache(void)
{
if (!smbd_memcache_ctx) {
- smbd_memcache_ctx = memcache_init(talloc_autofree_context(),
+ /*
+ * Note we MUST use the NULL context here, not the
+ * autofree context, to avoid side effects in forked
+ * children exiting.
+ */
+ smbd_memcache_ctx = memcache_init(NULL,
lp_max_stat_cache_size()*1024);
}
if (!smbd_memcache_ctx) {
struct event_context *smbd_event_context(void)
{
if (!smbd_event_ctx) {
- smbd_event_ctx = event_context_init(talloc_autofree_context());
+ /*
+ * Note we MUST use the NULL context here, not the
+ * autofree context, to avoid side effects in forked
+ * children exiting.
+ */
+ smbd_event_ctx = event_context_init(NULL);
}
if (!smbd_event_ctx) {
smb_panic("Could not init smbd event context");
TALLOC_FREE(smbd_server_conn);
TALLOC_FREE(smbd_msg_ctx);
TALLOC_FREE(smbd_event_ctx);
+ TALLOC_FREE(smbd_memcache_ctx);
if (how != SERVER_EXIT_NORMAL) {
int oldlevel = DEBUGLEVEL;