diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2017-01-19 06:10:15 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2017-01-19 06:10:15 +0000 |
commit | 8ac264258cc6242cade69f1c5964388bcfc76e15 (patch) | |
tree | 43d6b50d4912d5c9847de51a71af849146c0a63f | |
parent | ada276306773808ac12408a147d9f0b5b1406c03 (diff) |
Close #1513: Added pj_pool_safe_release() API.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5533 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjlib/include/pj/pool.h | 9 | ||||
-rw-r--r-- | pjlib/include/pj/pool_i.h | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/pjlib/include/pj/pool.h b/pjlib/include/pj/pool.h index 9adaeca9..59cd86c8 100644 --- a/pjlib/include/pj/pool.h +++ b/pjlib/include/pj/pool.h @@ -390,6 +390,15 @@ PJ_IDECL(pj_pool_t*) pj_pool_create(pj_pool_factory *factory, */ PJ_IDECL(void) pj_pool_release( pj_pool_t *pool ); + +/** + * Release the pool back to pool factory and set the pool pointer to zero. + * + * @param ppool Pointer to memory pool. + */ +PJ_IDECL(void) pj_pool_safe_release( pj_pool_t **ppool ); + + /** * Get pool object name. * diff --git a/pjlib/include/pj/pool_i.h b/pjlib/include/pj/pool_i.h index 2f5d407c..b57530c8 100644 --- a/pjlib/include/pj/pool_i.h +++ b/pjlib/include/pj/pool_i.h @@ -92,3 +92,10 @@ PJ_IDEF(void) pj_pool_release( pj_pool_t *pool ) (*pool->factory->release_pool)(pool->factory, pool); } + +PJ_IDEF(void) pj_pool_safe_release( pj_pool_t **ppool ) +{ + pj_pool_t *pool = *ppool; + *ppool = NULL; + pj_pool_release(pool); +} |