mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 01:26:49 +08:00
[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:
@@ -205,6 +205,7 @@ void *mpp_mem_pool_get_f(const char *caller, MppMemPool pool)
|
|||||||
impl->unused_count--;
|
impl->unused_count--;
|
||||||
impl->used_count++;
|
impl->used_count++;
|
||||||
ptr = node->ptr;
|
ptr = node->ptr;
|
||||||
|
node->check = node;
|
||||||
goto DONE;
|
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);
|
list_add(&node->list, &impl->unused);
|
||||||
impl->used_count--;
|
impl->used_count--;
|
||||||
impl->unused_count++;
|
impl->unused_count++;
|
||||||
|
node->check = NULL;
|
||||||
|
|
||||||
pthread_mutex_unlock(&impl->lock);
|
pthread_mutex_unlock(&impl->lock);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user