[svn-commits] tilghman: branch 1.4 r89093 - /branches/1.4/apps/app_queue.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Nov 7 17:39:37 CST 2007
Author: tilghman
Date: Wed Nov 7 17:39:37 2007
New Revision: 89093
URL: http://svn.digium.com/view/asterisk?view=rev&rev=89093
Log:
The member refcount must be incremented, to avoid using it after deallocation.
A huge thanks go to lvl- for patiently providing the necessary valgrind output
that was necessary to finding this problem of memory corruption.
Reported by: lvl-
Patch by: tilghman
Closes issue #11174
Modified:
branches/1.4/apps/app_queue.c
Modified: branches/1.4/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_queue.c?view=diff&rev=89093&r1=89092&r2=89093
==============================================================================
--- branches/1.4/apps/app_queue.c (original)
+++ branches/1.4/apps/app_queue.c Wed Nov 7 17:39:37 2007
@@ -2622,6 +2622,8 @@
callcompletedinsl = ((now - qe->start) <= qe->parent->servicelevel);
ast_mutex_unlock(&qe->parent->lock);
member = lpeer->member;
+ /* Increment the refcount for this member, since we're going to be using it for awhile in here. */
+ ao2_ref(member, 1);
hangupcalls(outgoing, peer);
outgoing = NULL;
if (announce || qe->parent->reportholdtime || qe->parent->memberdelay) {
@@ -2668,6 +2670,7 @@
queuename, qe->chan->uniqueid, peer->name, member->interface, member->membername,
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
ast_hangup(peer);
+ ao2_ref(member, -1);
goto out;
} else if (res2) {
/* Caller must have hung up just before being connected*/
@@ -2675,6 +2678,7 @@
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long)time(NULL) - qe->start);
record_abandoned(qe);
ast_hangup(peer);
+ ao2_ref(member, -1);
return -1;
}
}
@@ -2690,6 +2694,7 @@
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", qe->chan->name, peer->name);
record_abandoned(qe);
ast_hangup(peer);
+ ao2_ref(member, -1);
return -1;
}
@@ -2874,6 +2879,7 @@
ast_hangup(peer);
update_queue(qe->parent, member, callcompletedinsl);
res = bridge ? bridge : 1;
+ ao2_ref(member, -1);
}
out:
hangupcalls(outgoing, NULL);
More information about the svn-commits
mailing list