[asterisk-commits] kmoore: branch kmoore/cel_transfers r393715 - /team/kmoore/cel_transfers/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 4 17:43:47 CDT 2013


Author: kmoore
Date: Thu Jul  4 17:43:46 2013
New Revision: 393715

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393715
Log:
Check for NULL allocations

Modified:
    team/kmoore/cel_transfers/main/cel.c

Modified: team/kmoore/cel_transfers/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_transfers/main/cel.c?view=diff&rev=393715&r1=393714&r2=393715
==============================================================================
--- team/kmoore/cel_transfers/main/cel.c (original)
+++ team/kmoore/cel_transfers/main/cel.c Thu Jul  4 17:43:46 2013
@@ -1275,9 +1275,13 @@
 			if (!assoc->track_as_conf) {
 				RAII_VAR(struct ast_str *, extra, ast_str_create(64), ast_free);
 				assoc->track_as_conf = 1;
-				ast_str_set(&extra, 0, "%s,%s", chan_snapshot->name, snapshot->uniqueid);
-				report_event_snapshot(assoc->primary_snapshot, AST_CEL_BRIDGE_TO_CONF, NULL,
-					ast_str_buffer(extra), assoc->secondary_name);
+
+				if (extra) {
+					ast_str_set(&extra, 0, "%s,%s", chan_snapshot->name, snapshot->uniqueid);
+					report_event_snapshot(assoc->primary_snapshot, AST_CEL_BRIDGE_TO_CONF, NULL,
+						ast_str_buffer(extra), assoc->secondary_name);
+				}
+
 				ast_string_field_set(assoc, secondary_name, "");
 			}
 		}
@@ -1416,10 +1420,10 @@
 	struct ast_json *blob = obj->blob;
 	struct ast_json *json_exten = ast_json_object_get(blob, "exten");
 	struct ast_json *json_context = ast_json_object_get(blob, "context");
-	RAII_VAR(struct ast_str *, extra, ast_str_create(32), ast_free);
+	RAII_VAR(struct ast_str *, extra, ast_str_create(64), ast_free);
 	const char *exten, *context;
 
-	if (!json_exten || !json_context) {
+	if (!json_exten || !json_context || !extra) {
 		return;
 	}
 
@@ -1439,9 +1443,13 @@
 	struct stasis_message *message)
 {
 	struct ast_attended_transfer_message *xfer = stasis_message_data(message);
-	RAII_VAR(struct ast_str *, extra, ast_str_create(32), ast_free);
+	RAII_VAR(struct ast_str *, extra, ast_str_create(64), ast_free);
 	struct ast_bridge_snapshot *bridge1, *bridge2;
 	struct ast_channel_snapshot *channel1, *channel2;
+
+	if (!extra) {
+		return;
+	}
 
 	/* Make sure bridge1 is always non-NULL */
 	if (!xfer->to_transferee.bridge_snapshot) {




More information about the asterisk-commits mailing list