diff options
Diffstat (limited to 'src/commonlib/mem_pool.c')
-rw-r--r-- | src/commonlib/mem_pool.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/commonlib/mem_pool.c b/src/commonlib/mem_pool.c index c300c65d6e..d82ab18bd7 100644 --- a/src/commonlib/mem_pool.c +++ b/src/commonlib/mem_pool.c @@ -7,8 +7,11 @@ void *mem_pool_alloc(struct mem_pool *mp, size_t sz) { void *p; - /* Make all allocations be at least 8 byte aligned. */ - sz = ALIGN_UP(sz, 8); + if (mp->alignment == 0) + return NULL; + + /* We assume that mp->buf started mp->alignment aligned */ + sz = ALIGN_UP(sz, mp->alignment); /* Determine if any space available. */ if ((mp->size - mp->free_offset) < sz) |