[asterisk-commits] russell: trunk r85721 - in /trunk: ./ apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 15 16:11:06 CDT 2007


Author: russell
Date: Mon Oct 15 16:11:06 2007
New Revision: 85721

URL: http://svn.digium.com/view/asterisk?view=rev&rev=85721
Log:
Merged revisions 85720 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r85720 | russell | 2007-10-15 16:10:02 -0500 (Mon, 15 Oct 2007) | 3 lines

Ensure that no pending state changes are leaked when the device state change
thread gets stopped on module unload.

........

Modified:
    trunk/   (props changed)
    trunk/apps/app_queue.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=85721&r1=85720&r2=85721
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Mon Oct 15 16:11:06 2007
@@ -685,7 +685,7 @@
 
 static void *device_state_thread(void *data)
 {
-	struct statechange *sc;
+	struct statechange *sc = NULL;
 
 	while (!device_state.stop) {
 		ast_mutex_lock(&device_state.lock);
@@ -697,7 +697,7 @@
 
 		/* Check to see if we were woken up to see the request to stop */
 		if (device_state.stop)
-			return NULL;
+			break;
 
 		if (!sc)
 			continue;
@@ -705,7 +705,14 @@
 		handle_statechange(sc);
 
 		free(sc);
-	}
+		sc = NULL;
+	}
+
+	if (sc)
+		free(sc);
+
+	while ((sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry)))
+		free(sc);
 
 	return NULL;
 }




More information about the asterisk-commits mailing list