[mpp_mem_pool]: fix MppMemPoolNode double put issue

When a object is double put by mpp_mem_pool_put,
it will destroy the info of MppMemPoolImpl.

So set node->check = NULL when mpp_mem_pool_put, and it will check
failed adn return when double mpp_mem_pool_put.

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I54be2eae3a1d7e81579f89d3e80304abface3049
This commit is contained in:
Yandong Lin 2023-04-25 16:20:09 +08:00 committed by Herman Chen
parent 8c1f82c939
commit 13794992d9

View File

@ -205,6 +205,7 @@ void *mpp_mem_pool_get_f(const char *caller, MppMemPool pool)
impl->unused_count--;
impl->used_count++;
ptr = node->ptr;
node->check = node;
goto DONE;
}
}
@ -255,6 +256,7 @@ void mpp_mem_pool_put_f(const char *caller, MppMemPool pool, void *p)
list_add(&node->list, &impl->unused);
impl->used_count--;
impl->unused_count++;
node->check = NULL;
pthread_mutex_unlock(&impl->lock);
}