talloc: split the handling of FLAG_POOL/FLAG_POOLMEM in _talloc_free_internal
commit2d514be1ed3b8245157a0a51186ec7f9db828202
authorStefan Metzmacher <metze@samba.org>
Mon, 16 May 2011 17:06:07 +0000 (16 19:06 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 17 May 2011 06:22:18 +0000 (17 08:22 +0200)
tree2f4d026139c17eab53078376377e6f6269dfb316
parent28598e79330f37abbb709e2b317dde9c8d6c90b5
talloc: split the handling of FLAG_POOL/FLAG_POOLMEM in _talloc_free_internal

The optimization of the object_count == 1 case should only happen
for when we're not destroying the pool itself. And it should only
happen if the pool itself is still valid.

If the pool isn't valid (it has TALLOC_FLAG_FREE),
object_count == 1 does not mean that the pool is the last object,
which can happen if you use talloc_steal/move() on memory
from the pool and then free the pool itself.

Thanks to Volker for noticing this!

metze
lib/talloc/talloc.c