mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
Merge "Astobj2: Ensure all calls to __adjust_lock pass a valid object."
This commit is contained in:
@@ -510,6 +510,12 @@ struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags)
|
||||
|
||||
void ao2_iterator_restart(struct ao2_iterator *iter)
|
||||
{
|
||||
if (!is_ao2_object(iter->c)) {
|
||||
ast_log(LOG_ERROR, "Iterator container is not valid.\n");
|
||||
ast_assert(0);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Release the last container node reference if we have one. */
|
||||
if (iter->last_node) {
|
||||
enum ao2_lock_req orig_lock;
|
||||
|
@@ -186,6 +186,8 @@ static void hash_ao2_node_destructor(void *v_doomed)
|
||||
* same node.
|
||||
*/
|
||||
my_container = (struct ao2_container_hash *) doomed->common.my_container;
|
||||
ast_assert(is_ao2_object(my_container));
|
||||
|
||||
__adjust_lock(my_container, AO2_LOCK_REQ_WRLOCK, 1);
|
||||
|
||||
#if defined(AO2_DEBUG)
|
||||
|
@@ -878,6 +878,8 @@ static void rb_ao2_node_destructor(void *v_doomed)
|
||||
* same node.
|
||||
*/
|
||||
my_container = (struct ao2_container_rbtree *) doomed->common.my_container;
|
||||
ast_assert(is_ao2_object(my_container));
|
||||
|
||||
__adjust_lock(my_container, AO2_LOCK_REQ_WRLOCK, 1);
|
||||
|
||||
#if defined(AO2_DEBUG)
|
||||
|
Reference in New Issue
Block a user