summaryrefslogtreecommitdiffstats
path: root/lib/util/talloc_stack.c
Commit message (Collapse)AuthorAgeFilesLines
* talloc_stack: abort in developer me if no stackframe on talloc_tos()Rusty Russell2012-07-181-3/+7
| | | | | | | Don't tolerate leaks in developer mode. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* talloc_stack: report lazy freeing (panic if DEVELOPER).Rusty Russell2012-07-181-0/+11
| | | | | | | | | | | | | | | | | talloc_stackframe() stacks, so if you forget to free one, the outer one will free it. However, it's not a good idea to rely too heavily on this behaviour: it can lead to delays in the release of memory or destructors. I had an elaborate hack to make sure every talloc_stackframe() was freed in the exact same function it was allocated, however all bugs it caught were simply lazy freeing, so this patch just checks for that. This doesn't check for stackframes we don't free up on exit: that would be nice, but uncovers some uncomfortable (but probably harmless) cases. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* talloc_stack: always include the location when creating a talloc_stackframe().Rusty Russell2012-07-181-6/+7
| | | | | | | Much better for debugging. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* talloc_stack: handle more than one talloc_stackframe_pool()Rusty Russell2012-07-181-8/+9
| | | | | | | | | The only reason we make one stackframe parent of the next is so we use our parent's pool. That doesn't make sense if we're a new pool, and wouldn't work anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* talloc: added talloc_stackframe_exists()Andrew Tridgell2011-06-171-0/+17
| | | | | | | | | This can be used to tell if a talloc stackframe is currently available. Callers can use this to decide if they will use talloc_tos() or instead use an alternative strategy. This gives us a way to safely have calls to talloc_tos() in common code that may end up in external libraries, as long as all talloc_tos() calls in these pieces of common code check first that a stackframe is available.
* Use TALLOC_FREE in talloc_pop()Volker Lendecke2010-03-211-2/+1
|
* Use calloc instead of ZERO_STRUCTP in talloc_stackframe_create()Volker Lendecke2010-03-211-7/+5
|
* Trim an overlong lineVolker Lendecke2010-03-211-2/+2
|
* talloc_stack: reset stackframe pointers to NULLStefan Metzmacher2010-03-151-0/+2
| | | | | | This makes it easier to debug the code in future. metze
* talloc_stack: make sure we never let talloc_tos() return ts->talloc_stack[-1]Stefan Metzmacher2010-03-151-1/+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
* Take advantage of the easier-to-use thread macrosDerrell Lipman2009-05-131-8/+0
| | | | | | | - Now that we initialize for the non-thread-safe case in the macro, there's no need to do it here too. Derrell
* Allow a parameter to smb_thread_once's initialization functionDerrell Lipman2009-05-131-2/+2
| | | | | | | | | | | | - This should make life easier for ourselves. We're no longer constrained to the semantics of pthread_once, so let's allow passing a parameter to the initialization function. Some of Samba's init functions return a value. Although I haven't searched, I suspect that some of the init functions require in input parameters. The parameter added here can be used for input, output, or both, as necessary... or ignored, as is now done in talloc_stackframe_init(). Derrell
* Attempt to fix build farm on platforms where pthread_once_t is a struct.Jeremy Allison2009-04-201-2/+2
| | | | Jeremy.
* Fix the pthread_once initialization issue. Make talloc_stackframe useJeremy Allison2009-04-201-5/+21
| | | | | this. Jeremy.
* Ensure a tls key is only generated once - wrap create & destroy in a mutex.Jeremy Allison2009-04-141-1/+1
| | | | | | Change the function names to add _once to the tls_create & tls_destroy to make this obvious. Jeremy.
* Make talloc_stack threadsafe using TLS. Volker pleaseJeremy Allison2009-04-141-20/+73
| | | | | check. Passes make test and basic valgrind testing. Jeremy.
* Use common net utility code (address and sockaddr manipulation).Jelmer Vernooij2008-10-231-1/+1
|
* Import talloc_stack into util library.Jelmer Vernooij2008-10-231-0/+130