Merge "res_pjsip_pubsub: On notify fail deleted sub_tree is then referenced"
authorJoshua Colp <jcolp@digium.com>
Fri, 17 Apr 2015 15:25:23 +0000 (10:25 -0500)
committerGerrit Code Review <gerrit2@gerrit.digium.api>
Fri, 17 Apr 2015 15:25:23 +0000 (10:25 -0500)
main/bridge.c

index b1c42ff..64ef12d 100644 (file)
@@ -4474,6 +4474,12 @@ enum ast_transfer_result ast_bridge_transfer_attended(struct ast_channel *to_tra
        chan_bridged = to_transferee_bridge ? to_transferee : to_transfer_target;
        chan_unbridged = to_transferee_bridge ? to_transfer_target : to_transferee;
 
+       /*
+        * Race condition makes it possible for app to be NULL, so get the app prior to
+        * transferring with a fallback of "unknown".
+        */
+       app = ast_strdupa(ast_channel_appl(chan_unbridged) ?: "unknown");
+
        {
                int chan_count;
                SCOPED_LOCK(lock, the_bridge, ast_bridge_lock, ast_bridge_unlock);
@@ -4515,7 +4521,6 @@ enum ast_transfer_result ast_bridge_transfer_attended(struct ast_channel *to_tra
                goto end;
        }
 
-       app = ast_strdupa(ast_channel_appl(chan_unbridged));
        if (bridge_channel_internal_queue_attended_transfer(transferee, chan_unbridged)) {
                res = AST_BRIDGE_TRANSFER_FAIL;
                goto end;