1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

talloc_stack: make sure we never let talloc_tos() return ts->talloc_stack[-1]

In smbd there's a small gab between TALLOC_FREE(frame); before
be call smbd_parent_loop() where we don't have a valid talloc stackframe.

smbd_parent_loop() calls talloc_stackframe() only within the while(1) loop.
As DEBUG(2,("waiting for connections")) uses talloc_tos() to construct
the time header for the debug message we crash on some systems.

metze
This commit is contained in:
Stefan Metzmacher 2010-03-15 14:32:52 +01:00
parent 1eb0fbe68d
commit 10ed809a1a

View File

@ -181,7 +181,7 @@ TALLOC_CTX *talloc_tos(void)
struct talloc_stackframe *ts =
(struct talloc_stackframe *)SMB_THREAD_GET_TLS(global_ts);
if (ts == NULL) {
if (ts == NULL || ts->talloc_stacksize == 0) {
talloc_stackframe();
ts = (struct talloc_stackframe *)SMB_THREAD_GET_TLS(global_ts);
DEBUG(0, ("no talloc stackframe around, leaking memory\n"));