Skip to content

Commit

Permalink
feat mempool: added palloc zero size check
Browse files Browse the repository at this point in the history
Signed-off-by: John Sanpe <[email protected]>
  • Loading branch information
sanpeqf committed Feb 29, 2024
1 parent 7cb08a5 commit 8a792db
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/xdbd_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ static inline void *block_alloc(xdbd_pool_t *pool, size_t size) {
}

void *xdbd_palloc(xdbd_pool_t *pool, size_t size) {
if (bfdev_unlikely(!size)) {
bfdev_log_alert("malloc zero !!!\n");
return NULL;
}

if (size < XDBD_PAGE_SIZE)
return cache_alloc(pool, size);

Expand Down

0 comments on commit 8a792db

Please sign in to comment.