summaryrefslogtreecommitdiff
path: root/lib/util/talloc_stack.c
AgeCommit message (Collapse)AuthorFilesLines
2012-07-18talloc_stack: abort in developer me if no stackframe on talloc_tos()Rusty Russell1-3/+7
Don't tolerate leaks in developer mode. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-07-18talloc_stack: report lazy freeing (panic if DEVELOPER).Rusty Russell1-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>
2012-07-18talloc_stack: always include the location when creating a talloc_stackframe().Rusty Russell1-6/+7
Much better for debugging. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-07-18talloc_stack: handle more than one talloc_stackframe_pool()Rusty Russell1-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>
2011-06-17talloc: added talloc_stackframe_exists()Andrew Tridgell1-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.
2010-03-21Use TALLOC_FREE in talloc_pop()Volker Lendecke1-2/+1
2010-03-21Use calloc instead of ZERO_STRUCTP in talloc_stackframe_create()Volker Lendecke1-7/+5
2010-03-21Trim an overlong lineVolker Lendecke1-2/+2
2010-03-15talloc_stack: reset stackframe pointers to NULLStefan Metzmacher1-0/+2
This makes it easier to debug the code in future. metze
2010-03-15talloc_stack: make sure we never let talloc_tos() return ts->talloc_stack[-1]Stefan Metzmacher1-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
2009-05-13Take advantage of the easier-to-use thread macrosDerrell Lipman1-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
2009-05-13Allow a parameter to smb_thread_once's initialization functionDerrell Lipman1-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
2009-04-20Attempt to fix build farm on platforms where pthread_once_t is a struct.Jeremy Allison1-2/+2
Jeremy.
2009-04-20Fix the pthread_once initialization issue. Make talloc_stackframe useJeremy Allison1-5/+21
this. Jeremy.
2009-04-14Ensure a tls key is only generated once - wrap create & destroy in a mutex.Jeremy Allison1-1/+1
Change the function names to add _once to the tls_create & tls_destroy to make this obvious. Jeremy.
2009-04-14Make talloc_stack threadsafe using TLS. Volker pleaseJeremy Allison1-20/+73
check. Passes make test and basic valgrind testing. Jeremy.
2008-10-23Use common net utility code (address and sockaddr manipulation).Jelmer Vernooij1-1/+1
2008-10-23Import talloc_stack into util library.Jelmer Vernooij1-0/+130