diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-30 19:26:04 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-30 19:26:04 +0000 |
commit | 213a686818ae3b52921ac398852d0ffdff4f5f73 (patch) | |
tree | 9cb3c976f72d1999221cfb9a689ea8d7929fa8ad /apps/app_queue.c | |
parent | 64fb113167810bc0f1d1310f205d23b687ef8f18 (diff) |
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/branches/1.4@90348 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r-- | apps/app_queue.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index da99ab0a3..bee1997ac 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -1069,6 +1069,8 @@ static void rt_handle_member_record(struct call_queue *q, char *interface, const m->realtime = 1; add_to_interfaces(interface); ao2_link(q->members, m); + ao2_ref(m, -1); + m = NULL; q->membercount++; } } else { @@ -3036,6 +3038,8 @@ static int add_to_queue(const char *queuename, const char *interface, const char if ((new_member = create_queue_member(interface, membername, penalty, paused))) { new_member->dynamic = 1; ao2_link(q->members, new_member); + ao2_ref(new_member, -1); + new_member = NULL; q->membercount++; manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded", "Queue: %s\r\n" @@ -4021,6 +4025,8 @@ static int reload_queues(void) newm = create_queue_member(interface, membername, penalty, cur ? cur->paused : 0); ao2_link(q->members, newm); + ao2_ref(newm, -1); + newm = NULL; if (cur) ao2_ref(cur, -1); |