From 13794992d98370aa669c25a768bcfff3bc82ea37 Mon Sep 17 00:00:00 2001 From: Yandong Lin Date: Tue, 25 Apr 2023 16:20:09 +0800 Subject: [PATCH] [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 Change-Id: I54be2eae3a1d7e81579f89d3e80304abface3049 --- osal/mpp_mem_pool.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osal/mpp_mem_pool.cpp b/osal/mpp_mem_pool.cpp index d64fea3e..6ff39268 100644 --- a/osal/mpp_mem_pool.cpp +++ b/osal/mpp_mem_pool.cpp @@ -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); }