From b5ed09c3afe2c9122db6eec6dd994588d7d6a2c1 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 24 Sep 2010 18:45:52 +0200 Subject: [PATCH] Move talloc_enable_null_tracking() to the s3 daemons --- lib/talloc/talloc.c | 7 ------- source3/nmbd/nmbd.c | 8 +++++++- source3/smbd/server.c | 8 +++++++- source3/winbindd/winbindd.c | 8 +++++++- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c index cafe4d6e7a6..84947a77b00 100644 --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -1013,13 +1013,6 @@ _PUBLIC_ void *talloc_init(const char *fmt, ...) void *ptr; const char *name; - /* - * samba3 expects talloc_report_depth_cb(NULL, ...) - * reports all talloc'ed memory, so we need to enable - * null_tracking - */ - talloc_enable_null_tracking(); - ptr = __talloc(NULL, 0); if (unlikely(ptr == NULL)) return NULL; diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 5678c8e848c..fcbe50842d0 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -780,9 +780,15 @@ static bool open_sockets(bool isdaemon, int port) POPT_COMMON_SAMBA { NULL } }; - TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */ + TALLOC_CTX *frame; NTSTATUS status; + /* + * Do this before any other talloc operation + */ + talloc_enable_null_tracking(); + frame = talloc_stackframe(); + load_case_tables(); global_nmb_port = NMB_PORT; diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 07261b1e831..106eafcccd7 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -857,11 +857,17 @@ extern void build_options(bool screen); POPT_TABLEEND }; struct smbd_parent_context *parent = NULL; - TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */ + TALLOC_CTX *frame; NTSTATUS status; uint64_t unique_id; struct rpc_srv_callbacks spoolss_cb; + /* + * Do this before any other talloc operation + */ + talloc_enable_null_tracking(); + frame = talloc_stackframe(); + /* Initialize the event context, it will panic on error */ smbd_event_context(); diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 0c9cdcf52e1..d2344fd6962 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -1124,9 +1124,15 @@ int main(int argc, char **argv, char **envp) }; poptContext pc; int opt; - TALLOC_CTX *frame = talloc_stackframe(); + TALLOC_CTX *frame; NTSTATUS status; + /* + * Do this before any other talloc operation + */ + talloc_enable_null_tracking(); + frame = talloc_stackframe(); + /* glibc (?) likes to print "User defined signal 1" and exit if a SIGUSR[12] is received before a handler is installed */ -- 2.11.4.GIT