diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-05-16 20:23:13 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2011-06-07 19:59:50 +0200 |
commit | 3860609d9ec4ea7ac74cc1a7518d25699af6a8e3 (patch) | |
tree | 08181869187e81e22889461938c190f5c75aa8a6 | |
parent | 20e22b2def86397f9f22cb89292fe500d6313600 (diff) | |
download | samba-3860609d9ec4ea7ac74cc1a7518d25699af6a8e3.tar.gz |
talloc: make use of _talloc_free_poolmem() in _talloc_realloc()
This should follow the same logic...
metze
(cherry picked from commit 14b662ee4f278764b9dfd620851e908d29f29fc4)
(cherry picked from commit dc8b2979168c6688c647cdc39d321eb54bd0aa5b)
-rw-r--r-- | lib/talloc/talloc.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c index 0efeb7a7ada..fcd86d754a9 100644 --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -1550,7 +1550,6 @@ _PUBLIC_ void *_talloc_realloc(const void *context, void *ptr, size_t size, cons } new_ptr = talloc_alloc_pool(tc, size + TC_HDR_SIZE); - *talloc_pool_objectcount(pool_tc) -= 1; if (new_ptr == NULL) { new_ptr = malloc(TC_HDR_SIZE+size); @@ -1559,21 +1558,8 @@ _PUBLIC_ void *_talloc_realloc(const void *context, void *ptr, size_t size, cons if (new_ptr) { memcpy(new_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE); - TC_INVALIDATE_FULL_CHUNK(tc); - if (*talloc_pool_objectcount(pool_tc) == 1) { - /* - * If the pool is empty now reclaim everything. - */ - pool_tc->pool = TC_POOL_FIRST_CHUNK(pool_tc); - TC_INVALIDATE_POOL(pool_tc); - } else if (next_tc == pool_tc->pool) { - /* - * If it was reallocated and tc was the last - * chunk, we can reclaim the memory of tc. - */ - pool_tc->pool = tc; - } + _talloc_free_poolmem(tc, __location__ "_talloc_realloc"); } } else { |