From: Arran Cudbard-Bell Date: Fri, 20 Jun 2014 19:07:15 +0000 (+0100) Subject: Disable NULL context tracking X-Git-Tag: release_3_0_4_rc2~234 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=8f955da9c8af4a648e1610d4885f62f685ac7ef7;hp=81f79fac3c240ddecf206937afc612af2a6827c5;p=freeradius.git Disable NULL context tracking --- diff --git a/src/lib/debug.c b/src/lib/debug.c index 3f371e6..7051a92 100644 --- a/src/lib/debug.c +++ b/src/lib/debug.c @@ -722,11 +722,6 @@ int fr_fault_setup(char const *cmd, char const *program) TALLOC_CTX *tmp; bool *marker; - /* - * This should create a single NULL context used whenever - * something is talloced without a parent. - */ - talloc_enable_null_tracking(); tmp = talloc(NULL, bool); talloc_null_ctx = talloc_parent(tmp); talloc_free(tmp); diff --git a/src/main/radiusd.c b/src/main/radiusd.c index bffb2e5..a4e089a 100644 --- a/src/main/radiusd.c +++ b/src/main/radiusd.c @@ -301,6 +301,23 @@ int main(int argc, char *argv[]) } /* + * According to the talloc peeps, no two threads + * may modify any part of a ctx tree with a common + * root without synchronisation. + * + * So we can't run with a null context and threads. + */ + if (main_config.memory_report) { + if (spawn_flag) { + fprintf(stderr, "radiusd: The server cannot produce memory reports (-M) in threaded mode\n"); + exit(EXIT_FAILURE); + } + talloc_enable_null_tracking(); + } else { + talloc_disable_null_tracking(); + } + + /* * Better here, so it doesn't matter whether we get passed * -xv or -vx. */