[svn-commits] mmichelson: branch 1.6.0 r111534 - in /branches/1.6.0: ./ apps/app_queue.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Mar 27 19:17:18 CDT 2008


Author: mmichelson
Date: Thu Mar 27 19:17:17 2008
New Revision: 111534

URL: http://svn.digium.com/view/asterisk?view=rev&rev=111534
Log:
Merged revisions 111533 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r111533 | mmichelson | 2008-03-27 19:12:52 -0500 (Thu, 27 Mar 2008) | 10 lines

Fix a crash that would happen when attempting to unload the app_queue module.

The problem was that when the refcount on the queue hit 0, the destructor was
called, and inside the destructor, another function was called which would increase
the refcount back to 1 again and then decrease it again back to 0 for every member
in the queue. This meant that the destructor was being recursively called, leading
to a double free of the queue. This is now fixed by making sure to unlink the
queue from the queues container prior to the final unref of the queue.


........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_queue.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_queue.c?view=diff&rev=111534&r1=111533&r2=111534
==============================================================================
--- branches/1.6.0/apps/app_queue.c (original)
+++ branches/1.6.0/apps/app_queue.c Thu Mar 27 19:17:17 2008
@@ -1401,8 +1401,6 @@
 {
 	struct call_queue *q = obj;
 	int i;
-
-	ast_debug(0, "Queue destructor called for queue '%s'!\n", q->name);
 
 	free_members(q, 1);
 	ast_string_field_free_memory(q);
@@ -6169,6 +6167,8 @@
 {
 	int res;
 	struct ast_context *con;
+	struct ao2_iterator q_iter;
+	struct call_queue *q = NULL;
 
 	if (device_state.thread != AST_PTHREADT_NULL) {
 		device_state.stop = 1;
@@ -6211,6 +6211,11 @@
 
 	clear_and_free_interfaces();
 
+	q_iter = ao2_iterator_init(queues, 0);
+	while ((q = ao2_iterator_next(&q_iter))) {
+		ao2_unlink(queues, q);
+		queue_unref(q);
+	}
 	ao2_ref(queues, -1);
 
 	return res;




More information about the svn-commits mailing list