mempool:fix bug, use incorrect free in mempool init

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2023-02-16 12:28:54 +08:00 committed by Xiang Xiao
parent 93a1adf83e
commit df2925cf13

View File

@ -174,7 +174,11 @@ int mempool_init(FAR struct mempool_s *pool, FAR const char *name)
base = pool->alloc(pool, size);
if (base == NULL)
{
mempool_free(pool, pool->ibase);
if (pool->ibase)
{
pool->free(pool, pool->ibase);
}
return -ENOMEM;
}