[asterisk-commits] bweschke: branch 1.2 r43871 - /branches/1.2/apps/app_queue.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Sep 28 08:18:06 MST 2006


Author: bweschke
Date: Thu Sep 28 10:18:05 2006
New Revision: 43871

URL: http://svn.digium.com/view/asterisk?rev=43871&view=rev
Log:
 Fix race condion crash with get_member_status (#7864 - tim_ringenbach reported and patched)


Modified:
    branches/1.2/apps/app_queue.c

Modified: branches/1.2/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_queue.c?rev=43871&r1=43870&r2=43871&view=diff
==============================================================================
--- branches/1.2/apps/app_queue.c (original)
+++ branches/1.2/apps/app_queue.c Thu Sep 28 10:18:05 2006
@@ -432,11 +432,12 @@
 	QUEUE_NORMAL
 };
 
-static enum queue_member_status get_member_status(const struct call_queue *q)
+static enum queue_member_status get_member_status(struct call_queue *q)
 {
 	struct member *member;
 	enum queue_member_status result = QUEUE_NO_MEMBERS;
 
+	ast_mutex_lock(&q->lock);
 	for (member = q->members; member; member = member->next) {
 		if (member->paused) continue;
 
@@ -448,10 +449,12 @@
 			result = QUEUE_NO_REACHABLE_MEMBERS;
 			break;
 		default:
+			ast_mutex_unlock(&q->lock);
 			return QUEUE_NORMAL;
 		}
 	}
 	
+	ast_mutex_unlock(&q->lock);
 	return result;
 }
 



More information about the asterisk-commits mailing list