[asterisk-commits] russell: branch russell/event_performance r184313 - /team/russell/event_perfo...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 25 15:28:10 CDT 2009


Author: russell
Date: Wed Mar 25 15:27:59 2009
New Revision: 184313

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=184313
Log:
Simplify code a bit by moving it to where error handling doesn't require ast_free()

Modified:
    team/russell/event_performance/res/ais/evt.c

Modified: team/russell/event_performance/res/ais/evt.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/event_performance/res/ais/evt.c?view=diff&rev=184313&r1=184312&r2=184313
==============================================================================
--- team/russell/event_performance/res/ais/evt.c (original)
+++ team/russell/event_performance/res/ais/evt.c Wed Mar 25 15:27:59 2009
@@ -315,15 +315,12 @@
 		return;
 	}
 
+	if (type == AST_EVENT_DEVICE_STATE_CHANGE && ast_enable_distributed_devstate()) {
+		return;
+	}
+
 	if (!(publish_event = ast_calloc(1, sizeof(*publish_event)))) {
 		return;
-	}
-
-	if (type == AST_EVENT_DEVICE_STATE_CHANGE) {
-		if (ast_enable_distributed_devstate()) {
-			ast_free(publish_event);
-			return;
-		}
 	}
 
 	publish_event->type = type;
@@ -381,15 +378,12 @@
 		return;
 	}
 
+	if (type == AST_EVENT_DEVICE_STATE_CHANGE && ast_enable_distributed_devstate()) {
+		return;
+	}
+
 	if (!(subscribe_event = ast_calloc(1, sizeof(*subscribe_event)))) {
 		return;
-	}
-
-	if (type == AST_EVENT_DEVICE_STATE_CHANGE) {
-		if (ast_enable_distributed_devstate()) {
-			ast_free(subscribe_event);
-			return;
-		}
 	}
 
 	subscribe_event->type = type;




More information about the asterisk-commits mailing list