talloc: split the handling of FLAG_POOL/FLAG_POOLMEM in _talloc_free_internal
authorStefan Metzmacher <metze@samba.org>
Mon, 16 May 2011 17:06:07 +0000 (19:06 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 7 Jun 2011 17:59:47 +0000 (19:59 +0200)
commit20e22b2def86397f9f22cb89292fe500d6313600
tree37f1fa1610aaa52a125107389b0bc61b9ecbb120
parent7e66355bea005c0dbae399daf709e8315b232410
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
(cherry picked from commit 2d514be1ed3b8245157a0a51186ec7f9db828202)
(cherry picked from commit 4cf761bb5a030340625172a51212b11613efea02)
lib/talloc/talloc.c