mirror of
https://github.com/samba-team/samba.git
synced 2025-03-10 12:58:35 +03:00
talloc: make really sure only optimize realloc if there's only one pool chunk
*talloc_pool_objectcount(pool_tc) == 2 doesn't mean the one of the objects is the pool itself! So we better check for == 1 and calculate the chunk count. metze
This commit is contained in:
parent
14b662ee4f
commit
7102105c89
@ -1479,8 +1479,13 @@ _PUBLIC_ void *_talloc_realloc(const void *context, void *ptr, size_t size, cons
|
||||
size_t new_chunk_size = TC_ALIGN16(TC_HDR_SIZE + size);
|
||||
size_t space_needed;
|
||||
size_t space_left;
|
||||
unsigned int chunk_count = *talloc_pool_objectcount(pool_tc);
|
||||
|
||||
if (*talloc_pool_objectcount(pool_tc) == 2) {
|
||||
if (!(pool_tc->flags & TALLOC_FLAG_FREE)) {
|
||||
chunk_count -= 1;
|
||||
}
|
||||
|
||||
if (chunk_count == 1) {
|
||||
/*
|
||||
* optimize for the case where 'tc' is the only
|
||||
* chunk in the pool.
|
||||
|
Loading…
x
Reference in New Issue
Block a user