aboutsummaryrefslogtreecommitdiffstats
path: root/main/astobj2.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-10 19:53:17 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-10 19:53:17 +0000
commit8a586773c4c3c29ab2071222556bb8612dc00103 (patch)
tree50e910b85990f538647a6997f26f83df7a7d6fc3 /main/astobj2.c
parent413c1a0ec84fc399ececfd4946d4421c31cbf789 (diff)
backport astobj2 race condition fix. This function is the exact same as trunk
so it applies here as well. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@82198 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/astobj2.c')
-rw-r--r--main/astobj2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main/astobj2.c b/main/astobj2.c
index 5fef8b1fa..0f23dfc08 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -513,6 +513,7 @@ void * ao2_iterator_next(struct ao2_iterator *a)
{
int lim;
struct bucket_list *p = NULL;
+ void *ret = NULL;
if (INTERNAL_OBJ(a->c) == NULL)
return NULL;
@@ -553,14 +554,15 @@ found:
a->version = p->version;
a->obj = p;
a->c_version = a->c->version;
+ ret = EXTERNAL_OBJ(p->astobj);
/* inc refcount of returned object */
- ao2_ref(EXTERNAL_OBJ(p->astobj), 1);
+ ao2_ref(ret, 1);
}
if (!(a->flags & F_AO2I_DONTLOCK))
ao2_unlock(a->c);
- return p ? EXTERNAL_OBJ(p->astobj) : NULL;
+ return ret;
}
/* callback for destroying container.