BUG/MINOR: memory: make the thread-local cache allocator set the debugging link
authorWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2018 19:09:12 +0000 (20:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2018 19:12:31 +0000 (20:12 +0100)
commit8e9f4531cb18d424139285557f0fe0895fd46c5b
tree1a2d0a238f62a0134ff145f8289ec09615341e46
parentf95838ca2da07766d14f11359b1a30c1ad6c7361
BUG/MINOR: memory: make the thread-local cache allocator set the debugging link

When building with DEBUG_MEMORY_POOLS, an element returned from the
cache would not have its pool link initialized unless it's allocated
using pool_alloc(). This is problematic for buffer allocators which
use pool_alloc_dirty(), as freeing this object will make the code
think it was allocated from another pool. This patch does two things :
  - make __pool_get_from_cache() set the link
  - remove the extra initialization from pool_alloc() since it's always
    done in either __pool_get_first() or __pool_refill_alloc()

This patch is marked MINOR since it only affects code explicitly built
for debugging. No backport is needed.
include/common/memory.h