]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't destroy a codec that has not been created (MODAPP-101)
authorMichael Jerris <mike@jerris.com>
Tue, 1 Jul 2008 17:45:35 +0000 (17:45 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 1 Jul 2008 17:45:35 +0000 (17:45 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8875 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_async.c

index 2cf836b04afc541fe533c77b95a6126d0a2a13c9..2557cda0d8360fedab041806c75c2e748dc63230 100644 (file)
@@ -495,6 +495,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
        switch_status_t status = SWITCH_STATUS_FALSE;
        switch_channel_t *channel = switch_core_session_get_channel(session);
        switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
+       int codec_initialized = 0;
 
        if ((tsession = switch_core_session_locate(uuid))) {
                struct eavesdrop_pvt *ep = NULL;
@@ -554,6 +555,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                        goto end;
                }
 
+               codec_initialized = 1;
+
                switch_core_session_set_read_codec(session, &codec);
                write_frame.codec = &codec;
                write_frame.data = buf;
@@ -683,8 +686,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                }
 
          end:
-
-               switch_core_codec_destroy(&codec);
+               if ( codec_initialized )
+                       switch_core_codec_destroy(&codec);
 
                if (bug) {
                        switch_core_media_bug_remove(tsession, &bug);