Skip to content

Commit df2925c

Browse files
anjiahao1xiaoxiang781216
authored andcommitted
mempool:fix bug, use incorrect free in mempool init
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
1 parent 93a1adf commit df2925c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mm/mempool/mempool.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ int mempool_init(FAR struct mempool_s *pool, FAR const char *name)
174174
base = pool->alloc(pool, size);
175175
if (base == NULL)
176176
{
177-
mempool_free(pool, pool->ibase);
177+
if (pool->ibase)
178+
{
179+
pool->free(pool, pool->ibase);
180+
}
181+
178182
return -ENOMEM;
179183
}
180184

0 commit comments

Comments
 (0)