talloc: split the handling of FLAG_POOL/FLAG_POOLMEM in _talloc_free_internal
commit4cf761bb5a030340625172a51212b11613efea02
authorStefan Metzmacher <metze@samba.org>
Mon, 16 May 2011 17:06:07 +0000 (16 19:06 +0200)
committerKarolin Seeger <kseeger@samba.org>
Fri, 20 May 2011 19:08:54 +0000 (20 21:08 +0200)
treea4842a20491ee03702d20c5e970abef2ecd3ad56
parenteb15457258ad7a54d5a3c4431be8307331e3a6e3
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)
lib/talloc/talloc.c