summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-04-23 06:50:44 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-04-23 06:50:44 -0500
commita06924e9d960222df5a6862f7a03c45724386ce8 (patch)
tree8f6cb3c56f2da3442e0c444186c6a4965880a5cc
parent1474bb05f64c2b1db4417667a4d27576dbe219a7 (diff)
parent73efb093b8cd1a81cee5f9fb0120ac7f74a82ea4 (diff)
Merge "Astobj2: Ensure all calls to __adjust_lock pass a valid object." into 13
-rw-r--r--main/astobj2_container.c6
-rw-r--r--main/astobj2_hash.c2
-rw-r--r--main/astobj2_rbtree.c2
3 files changed, 10 insertions, 0 deletions
diff --git a/main/astobj2_container.c b/main/astobj2_container.c
index dc6f5e5c5..5a27a0ae5 100644
--- a/main/astobj2_container.c
+++ b/main/astobj2_container.c
@@ -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;
diff --git a/main/astobj2_hash.c b/main/astobj2_hash.c
index 37d4b6017..066999f49 100644
--- a/main/astobj2_hash.c
+++ b/main/astobj2_hash.c
@@ -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)
diff --git a/main/astobj2_rbtree.c b/main/astobj2_rbtree.c
index 2e3a73eaa..d8195d47f 100644
--- a/main/astobj2_rbtree.c
+++ b/main/astobj2_rbtree.c
@@ -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)