lib: talloc: Fix pool object accounting when doing talloc_realloc() in the ALWAYS_REA...
authorJeremy Allison <jra@samba.org>
Tue, 20 Oct 2020 19:14:58 +0000 (12:14 -0700)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 9 Nov 2020 02:46:49 +0000 (02:46 +0000)
commit6e0aab0b4038255b2d63e8687924a21d77bace91
treeada19e26a51d6aa5c7eb6c86a3417c96140eab71
parent86eb6423bdcedf3433f3dbcf026573a238cf0d87
lib: talloc: Fix pool object accounting when doing talloc_realloc() in the ALWAYS_REALLOC compiled case.

tc_alloc_pool() or the fallback malloc can return NULL.

Wait until we know we are returning a valid pointer
before decrementing pool_hdr->object_count due to
reallocing out of the talloc_pool.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14540

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/talloc/talloc.c