talloc_stack: make sure we never let talloc_tos() return ts->talloc_stack[-1]
authorStefan Metzmacher <metze@samba.org>
Mon, 15 Mar 2010 13:32:52 +0000 (14:32 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 29 Mar 2010 07:41:04 +0000 (09:41 +0200)
commita05f9615840de80dad216348fc3c7678911802d9
tree2e8bd581d1ebf30605cad5a0f7619d8e27eefa90
parenta59864d90b061909b96d6876a24e0a0a3e9d38b8
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
we 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
(cherry picked from commit 10ed809a1a31be50ce09142eb99b3a243ae8b940)
(cherry picked from commit 0c0e54cbb967150b91b3d83fb75c8c971875cb21)
lib/util/talloc_stack.c