]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't leak on switch_ivr_wait_for_answer when peer channel is already answered or...
authorMichael Jerris <mike@jerris.com>
Mon, 19 May 2008 19:24:20 +0000 (19:24 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 19 May 2008 19:24:20 +0000 (19:24 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8471 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_originate.c

index a4ffca704dd63d2aeede79607b100af24cafccc0..1e42c57530de6d1adfaec8fa2d71b6e0ddfa93fd 100644 (file)
@@ -268,6 +268,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
        const char *var = switch_channel_get_variable(caller_channel, "call_timeout");
        switch_time_t start = 0;
        
+       if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
+               return SWITCH_STATUS_SUCCESS;
+       }
+
        switch_zmalloc(write_frame.data, SWITCH_RECOMMENDED_BUFFER_SIZE);
        write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
 
@@ -281,10 +285,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
        timelimit *= 1000000;
        start = switch_timestamp_now();
 
-       if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
-               return SWITCH_STATUS_SUCCESS;
-       }
-
        if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
                ringback_data = switch_channel_get_variable(caller_channel, "transfer_ringback");
        }