[asterisk-commits] mmichelson: trunk r181244 - /trunk/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 11 09:28:48 CDT 2009


Author: mmichelson
Date: Wed Mar 11 09:28:40 2009
New Revision: 181244

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=181244
Log:
Fix segfault when dialing a typo'd queue

If trying to dial a non-existent queue, there would
be a segfault when attempting to access q->weight, even
though q was NULL. This problem was introduced during
the queue-reset merge and thus only affects trunk.

(closes issue #14643)
Reported by: alecdavis


Modified:
    trunk/apps/app_queue.c

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/apps/app_queue.c?view=diff&rev=181244&r1=181243&r2=181244
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Wed Mar 11 09:28:40 2009
@@ -1826,11 +1826,13 @@
 			ast_variables_destroy(queue_vars);
 		}
 		/* update the use_weight value if the queue's has gained or lost a weight */ 
-		if (!q->weight && prev_weight) {
-			ast_atomic_fetchadd_int(&use_weight, -1);
-		}
-		if (q->weight && !prev_weight) {
-			ast_atomic_fetchadd_int(&use_weight, +1);
+		if (q) {
+			if (!q->weight && prev_weight) {
+				ast_atomic_fetchadd_int(&use_weight, -1);
+			}
+			if (q->weight && !prev_weight) {
+				ast_atomic_fetchadd_int(&use_weight, +1);
+			}
 		}
 		/* Other cases will end up with the proper value for use_weight */
 		ao2_unlock(queues);




More information about the asterisk-commits mailing list