[svn-commits] mmichelson: branch group/CCSS_Monitor_Restructure r244495 - /team/group/CCSS_...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Feb 2 18:49:11 CST 2010


Author: mmichelson
Date: Tue Feb  2 18:49:07 2010
New Revision: 244495

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=244495
Log:
Fix that race condition...again.

Finally found the correct solution to that silly
race condition I had. Taking a food break really does
help you to recharge and think things through more clearly.


Modified:
    team/group/CCSS_Monitor_Restructure/main/ccss.c

Modified: team/group/CCSS_Monitor_Restructure/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/main/ccss.c?view=diff&rev=244495&r1=244494&r2=244495
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Tue Feb  2 18:49:07 2010
@@ -960,7 +960,7 @@
 	}
 
 	if (!(generic_list->sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, generic_monitor_devstate_cb,
-				"Requesting CC", (void *)generic_list->device_name, AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, 
+				"Requesting CC", NULL, AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, 
 				monitor->interface->name, AST_EVENT_IE_END))) {
 		cc_unref(generic_list, "Failed to subscribe to device state");
 		return NULL;
@@ -988,14 +988,16 @@
 		 * time between subscribing to its device state and the time this executes.
 		 * Not really a big deal.
 		 */
+		ast_free((char *) gtcd->device_name);
 		ast_free(gtcd);
 		return 0;
 	}
 
 	if (generic_list->current_state == new_state) {
 		/* The device state hasn't actually changed, so we don't really care */
+		cc_unref(generic_list, "Kill reference of generic list in devstate taskprocessor callback");
+		ast_free((char *) gtcd->device_name);
 		ast_free(gtcd);
-		cc_unref(generic_list, "Kill reference of generic list in devstate taskprocessor callback");
 		return 0;
 	}
 
@@ -1010,6 +1012,7 @@
 		}	
 	}
 	cc_unref(generic_list, "Kill reference of generic list in devstate taskprocessor callback");
+	ast_free((char *) gtcd->device_name);
 	ast_free(gtcd);
 	return 0;
 }
@@ -1027,10 +1030,14 @@
 		return;
 	}
 
-	gtcd->device_name = userdata;
+	if (!(gtcd->device_name = ast_strdup(ast_event_get_ie_str(event, AST_EVENT_IE_DEVICE)))) {
+		ast_free(gtcd);
+		return;
+	}
 	gtcd->new_state = ast_event_get_ie_uint(event, AST_EVENT_IE_STATE);
 
 	if (ast_taskprocessor_push(cc_core_taskprocessor, generic_monitor_devstate_tp_cb, gtcd)) {
+		ast_free((char *)gtcd->device_name);
 		ast_free(gtcd);
 	}
 }




More information about the svn-commits mailing list