diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-30 19:34:47 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-30 19:34:47 +0000 |
commit | 7cfa10f05b13911f3595a3db8b058ee587dfd8d5 (patch) | |
tree | 7a9b4cd5fcd7c6762668e03902ccc2b5f07e8343 /main/astobj2.c | |
parent | 2393a4999d3cee78abaec1ff3244bd320d59fb97 (diff) |
Merged revisions 90348 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r90348 | russell | 2007-11-30 13:26:04 -0600 (Fri, 30 Nov 2007) | 8 lines
Change the behavior of ao2_link(). Previously, in inherited a reference.
Now, it automatically increases the reference count to reflect the reference
that is now held by the container.
This was done to be more consistent with ao2_unlink(), which automatically
releases the reference held by the container. It also makes it so it is
no longer possible for a pointer to be invalid after ao2_link() returns.
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@90351 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/astobj2.c')
-rw-r--r-- | main/astobj2.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/main/astobj2.c b/main/astobj2.c index e7a091c80..2d3611889 100644 --- a/main/astobj2.c +++ b/main/astobj2.c @@ -363,6 +363,7 @@ void *ao2_link(struct ao2_container *c, void *user_data) p->version = ast_atomic_fetchadd_int(&c->version, 1); AST_LIST_INSERT_TAIL(&c->buckets[i], p, entry); ast_atomic_fetchadd_int(&c->elements, 1); + ao2_ref(user_data, +1); ao2_unlock(c); return p; |